LinkSausage
BAN USER- -2of 2 votes
AnswersWrite code to traverse a NxM matrix in a zig-zag fashion
- LinkSausage in United States| Report Duplicate | Flag | PURGE
Google Dev Lead - -1of 1 vote
AnswersGiven a random string (reasonable length L), knowing all possible font sizes (e.g. font Fn has min_width, max_width, min_height, max_height), knowing fixed screen size, find the max font size that can display said string
- LinkSausage in United States| Report Duplicate | Flag | PURGE
Google Dev Lead - 0of 0 votes
AnswersImplement a2i - what are the edge cases you can think of? Signed integer only, subject to OS dependent MIN, MAX values
- LinkSausage in United States| Report Duplicate | Flag | PURGE
Google Dev Lead
@srterpe The interviewer was asking whether there is a faster way to narrow down the font size range to try. He said if there are 1000+ font sizes is there a better way.
- LinkSausage January 05, 2017You missed "-" "+" (+1 is OK but + is not integer)
Most of the cases you raised are correct except they are of the same pattern (i.e. none [0-9] after first char)
The interviewer was pretty peculiar about NULL vs. empty string. I said check input in the beginning but he dismissed NULL outright ("that is an application level error"). Then reminded me of checking empty string.
Nitish is on the right track. Correct result would be 1, 4, 2, 7, 5, 3, 8, 6, 9
- LinkSausage January 05, 2017
@albin.severinson - the interviewer did mention it was a "bounding" problem. So your hunch is right. Although given the fact the input string length is unknown, I don't see how useful an greedy/opportunistic bounding approach is. Now think of it, if the question was asked "what's the quickest way to find out whether a random string can be rendered on display", that could be just a binary search solution as you suggested.
- LinkSausage January 05, 2017