Google Interview Report
- 0of 0 votes
AnswersThe two arrays [1,2,3,4,5], [2,3,4,5,6] find the first subfix and the second prefix the same longest case, such as the example is [2, 3,4,5]
- ajay.raj December 06, 2017 in United States
Length of 4.
Followup: how to do two-dimensional array, how to optimize.| Report Duplicate | Flag | PURGE
Google SDE1 - 1of 1 vote
AnswersGiven a function randBetween (double d1, double d2), return a random double between d1 and d2,
- ajay.raj December 06, 2017 in United States
returns a random point in a rectangle.
Give a bunch of rectangles, using randBetween to print a random point in the rectangle
follow up: What to do if you call this func many times| Report Duplicate | Flag | PURGE
Google SDE1 - 1of 1 vote
AnswersGiven Two string, ask whether they can become the same after just one swap of two chars in one string.
- ajay.raj December 06, 2017 in United States
For example:
"abcd", "bacd" Yes, you can swap ab in the first string to make it the same as the second string
"abcd", "adbc" can not
Follow-up, given Two string, ask whether they can become the same after N swaps of two chars in one string g, assuming that the swap does not overlap.
(str [0] <-> str [2] str [2] and str [0] will not be swapped with other locations)| Report Duplicate | Flag | PURGE
Google SDE1