init.d
BAN USER
- 0of 2 votes
AnswersYou are given a List containing all the Symbols of the periodic table.
- init.d in United States
You are also given a List containing all the words in the English dictionary.
How do you find the longest word that can be made using symbols of the periodic table?
Note: Symbols can be 1 or 2 chars long (for eg. O => oxygen, Fe => Iron)| Report Duplicate | Flag | PURGE
Ebay Software Engineer / Developer Algorithm - 0of 0 votes
AnswersCampus Interview question:
- init.d in United States
Q: What is the difference between a HashMap and HashTable?
A: HashTable is always synchronized - undesirable - HashMap is better
Q: How is ConcurrentHashMap different from Collections.tosynchronized(map)?
A: First locks individual rows the second locks whole structure| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer - 1of 1 vote
AnswersCampus Interview question:
- init.d in United States
Design the File System for an OS.| Report Duplicate | Flag | PURGE
Groupon Software Engineer / Developer General Questions and Comments
@miguel - great solution! i used the dp / edit distance approach like you suggested and i think it works.. not sure if i did it exactly like you said... but same general idea..
private static boolean isKPalindrome(String s, int k) {
boolean result = false;
String r = new StringBuilder(s).reverse().toString();
char[] sc = s.toCharArray();
char[] rc = r.toCharArray();
int[][] t = new int[s.length()/2 + 1][s.length()/2 + 1];
int i = 0;
int j = 0;
for (;i<t.length;i++) {
t[i][0] = i;
}
for (;j<t[0].length;j++) {
t[0][j] = j;
}
for (i = 1; i < t.length;i++) {
for (j = 1; j < t.length;j++) {
int c =0;
if(sc[i] == rc[j]) {
c = 0;
} else {
c = 2;
}
t[i][j] = Math.min(Math.min(t[i-1][j] +1 , t[i][j-1] + 1), c + t[i-1][j-1]);
if(i == t.length-1 || j == t.length-1) {
result = t[i][j] <= k ? true : false;
break;
}
}
}
return result;
}
private static void printFunny(int n) {
for (int i =1; i <= n; i++) {
for (int j=0; j < n-i; j++) {
System.out.print("*");
}
for (int k = 0; k < 2*(i-1) + 1; k++) {
if (k % 2 == 0)
System.out.print(i);
else
System.out.print("*");
}
for (int l=0; l < n-i; l++) {
System.out.print("*");
}
System.out.println();
}
System.out.println();
}
Output results:
***1***
**2*2**
*3*3*3*
4*4*4*4
****1****
***2*2***
**3*3*3**
*4*4*4*4*
5*5*5*5*5
******1******
*****2*2*****
****3*3*3****
***4*4*4*4***
**5*5*5*5*5**
*6*6*6*6*6*6*
7*7*7*7*7*7*7
********1********
*******2*2*******
******3*3*3******
*****4*4*4*4*****
****5*5*5*5*5****
***6*6*6*6*6*6***
**7*7*7*7*7*7*7**
*8*8*8*8*8*8*8*8*
9*9*9*9*9*9*9*9*9
@Anonymous - there's a typo - it should be i++ not 1++
- init.d November 14, 2013