quickuser
BAN USER 0 Answers Google Interview
I have my google onsite interview in september 2015,I am a fresher and don't have any idea about troubleshooting. I would like to know how should I start and from where I should study troubleshooting so that I can clear my interview. I have good knowledge in DS and algorithms.
 quickuser July 21, 2015 Flag  PURGE
package com.company;
import java.lang.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
int a[] = {1,5,100};
int b[] = {1,45,75};
int c[] = {1,100,200};
Arrays.sort(a);
Arrays.sort(b);
Arrays.sort(c);
int p = a.length;
int q = b.length;
int r = c.length;
int diff = Integer.MAX_VALUE;
int i=0,j=0,k=0;
int[] arr = new int[3];
while(i<p  j<q  k<r){
int max_v = Math.max(a[i],Math.max(b[j],c[k]));
int min_v = Math.min(a[i],Math.min(b[j],c[k]));
int curr_diff = max_v  min_v;
if(curr_diff < diff){
diff = curr_diff;
arr[0] = a[i];
arr[1] = b[j];
arr[2] = c[k];
}
if(curr_diff == 0) {
break;
}
if(a[i] == min_v) i++;
else if(b[j] == min_v) j++;
else k++;
}
System.out.print(arr[0] + " " + arr[1] + " " + arr[2]);
}
}

quickuser
May 02, 2016 public class Main {
public static void main(String[] args) {
int a[] = { 1,5,7 };
int n = a.length;
if(n < 3) System.out.println("Is a seq");
else {
int max = Integer.MIN_VALUE;
int min = Integer.MAX_VALUE;
int flag = 0;
for (int i = 0; i < n; i++) {
max = (a[i] > max) ? a[i] : max;
min = (a[i] < min) ? a[i] : min;
}
int d = (max  min) / (n  1);
for (int i = 1; i < n; i++) {
if (Math.abs(a[i]  a[i  1]) % d != 0) flag = 1;
}
if (flag == 0)
System.out.println("Is a seq");
else System.out.println("Is not a seq");
}
}
}
 quickuser May 02, 2016