piaoyonghui
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
public static boolean hasCheated(String s1,String s2, int N){
for(int i=0;i<s1.length();i++){
if(i+N <= s1.length()){
if(s2.contains(s1.substring(i, i+N))) return true;
}
}
return false;
}
Comment hidden because of low score. Click to expand.
0
of 0 vote
public static void print(int n) {
int[] a = new int[n];
for(int i=0;i<n;i++){
a[i] = 1;
}
int k =1;
//get k=n^n for total rows
for (int j = 1; j <= n; j++) {
k = k * n;
}
for(int x = 1;x<=k;x++){
for(int i=0;i<n;i++){
System.out.print(a[i]);
}
a[a.length-1]++;
for(int z=a.length-1;z>0;z--){
if(a[z]>n){
a[z-1]++;
a[z]=a[z]%n==0?n:a[z]%n;
}
}
System.out.println();
}
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Merge sort:
- piaoyonghui March 30, 2014