Jubilant Questions
Jubilant Questions
x = 35
o/p- Yes
// n = 5, m = 3
boolean findX(int[][] arr, int n, int m, int x) {
//x=35;boolean found=false; int a=n-1; int b=m-1
for(int i=a;i >=0;i--){
int counter=b;
while(counter>=0){
if(x>arr[i][b])
b=counter;
break;
if(x==arr[i][b]){
found=true;
break;
}
if(counter==0 && x!=arr[i][b]){
b=counter;
}
counter--;
}
if(found){
return true;
}
}
return false;
}
class Node {
int data;
Node next;
}
Node current=head;
int counter=0;
while(current!=null){
counter++;
current=current.next;
}
counter=counter-n;
counter++;
int count=0;
Node newOne=head;
while(count<counter){
newOne=newOne.next;
count++;
}
return newOne.value;
Error / Output:
class Test {
int var=80;
public static void method1() {
System.out.println("I am first");
}
Error / Output:
class Value {
int x;
Value(int x) {
this.x = x;
}
}
class Test {
OUTPUT:
v1=Value@2a139a55 and v2Value@15db9742
v1=Value@15db9742 and v2Value@2a139a55
val1=Value@2a139a55 and val2=Value@15db9742
i = 10, j = 20