Obiwana
BAN USER- -6of 8 votes
Answersgiven a board with black (1) and white (0), black are all connected. find the min rectangle that contains all black.
- Obiwana in United States
example:
0 0 0 0 0
0 1 1 1 0
0 1 1 0 0
0 1 0 0 0
0 0 0 0 0
the min rectangle contains all black (1) is the rectangle from (1,1) - (3, 3)| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - 2of 4 votes
AnswersGiven a dictionary, and a list of letters ( or consider as a string), find the longest word that only uses letters from the string. [I didn't meet this question, what's the best solution?]
- Obiwana in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - 0of 2 votes
AnswersWrite a function return an integer that satisfies the following conditions:
- Obiwana in United States
1) positive integer
2) no repeated digits, eg., 123 (valid), 122 (invalid)
3) incremental digit sequence, eg., 1234 (valid) 1243(invalid)
4) the returned integer MUST be the smallest one that greater than the input. eg., input=987, return=1023
function signature could be like this:
String nextInteger(String input)| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - 14of 14 votes
AnswersGiven a 2-D matrix represents the room, obstacle and guard like the following (0 is room, B->obstacle, G-> Guard):
- Obiwana in United States
0 0 0
B G G
B 0 0
calculate the steps from a room to nearest Guard and set the matrix, like this
2 1 1
B G G
B 1 1
Write the algorithm, with optimal solution.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer
I had a second thought. assuming 0 being the first digit doesn't make sense in this question because this way 0 cannot appear in any integer. So, 0 is the last digit in two scenarios:
1) input-> 789, output->790
2) input-> 987, output->1023
Let me know if this makes sense to you.
It is a question asked in Google interview.
- Obiwana March 11, 2014