Fix some errors in java code.
parent
d3c2184af8
commit
92568a4c70
|
@ -32,7 +32,7 @@ import java.util.Stack;
|
||||||
}
|
}
|
||||||
long ans[]=nextLargerElement(arr,n); // functions that print array for calculating next greater element
|
long ans[]=nextLargerElement(arr,n); // functions that print array for calculating next greater element
|
||||||
for (int i=0;i<ans.length;i++){
|
for (int i=0;i<ans.length;i++){
|
||||||
System.out.print(ans[i]+" ")
|
System.out.print(ans[i]+" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static long[] nextLargerElement(long[] arr, int n)
|
public static long[] nextLargerElement(long[] arr, int n)
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
class Main {
|
class Main {
|
||||||
|
|
||||||
public static void main(String[] args){
|
public static void main(String[] args){
|
||||||
max = 1000;
|
int max = 1000;
|
||||||
stack object = new stack(max);
|
stack object = new stack(max);
|
||||||
object.push(1);
|
object.push(1);
|
||||||
object.push(2);
|
object.push(2);
|
||||||
|
|
|
@ -57,11 +57,11 @@ class GFG {
|
||||||
System.out.println(LCSubStr(X.toCharArray(), Y.toCharArray(), m, n));
|
System.out.println(LCSubStr(X.toCharArray(), Y.toCharArray(), m, n));
|
||||||
|
|
||||||
// Test 2:
|
// Test 2:
|
||||||
String X = "abcdefgh";
|
String X2 = "abcdefgh";
|
||||||
String Y = "abaabcfg";
|
String Y2 = "abaabcfg";
|
||||||
int m = X.length();
|
int m2 = X.length();
|
||||||
int n = Y.length();
|
int n2 = Y.length();
|
||||||
System.out.println(LCSubStr(X.toCharArray(), Y.toCharArray(), m, n));
|
System.out.println(LCSubStr(X2.toCharArray(), Y2.toCharArray(), m2, n2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Time Complexity -> O(m*n)
|
// Time Complexity -> O(m*n)
|
||||||
|
|
Loading…
Reference in New Issue