Mukesh Dua
BAN USER- 0of 0 votes
AnswersAs you are on Seattle, tell me how many rain drops pour on earth every year
- Mukesh Dua in United States| Report Duplicate | Flag | PURGE
Microsoft SDE-2
His main point is we can't load all numbers in memory.
- Mukesh Dua April 24, 2014Sum is not too large. He mentioned that let's say we are having maximum number of 64 bit machine(2pow64 -1 )
How to handle this scneario
Infact i answered same. Then he proceed and asked another question that numbers are too large and you can't store in memory.
- Mukesh Dua April 24, 2014Instead of blaming comment, i would recommend to provide solution.
- Mukesh Dua April 22, 2014In Tries, I would first search S, then Se, then Sea. Finally once we are sea, i'll search in all child nodes of it.
I think same approach would be implemented in Google also while searching the element.
I don't think above answer is correct. I think question is to of pattern maching. Sea!tle should be found in dictionary with best matching.
I would use Tries to solve the problem.
public static int sortIntDescending(int num) {
- Mukesh Dua August 02, 2015String sort = "";
for (int l = 9; l >= 0; l--) {
int rem = num % 10;
int tx = num / 10;
while (tx != 0) {
if (rem == l)
sort+=String.valueOf(rem);
rem = tx % 10;
tx = tx / 10;
}
}
return Integer.valueOf(sort);
}