Google Interview Report
- 0of 0 votes
AnswersA car can receive two instructions A and R. A moves forward for a second and then doubles in speed. R stopped and then reversed. Given a String composed of AR, find where will the car stop.
- ajay.raj December 17, 2017 in United States
Follow-up, given the location if the final stop, find the instruction string.| Report Duplicate | Flag | PURGE
Google SDE1 - 0of 0 votes
Answerslist, push is pushed to the head, pop return each element with the same probability. If you push a sorted list into it, how to pop a sorted list out. Follow-up, asked if pop is from head, and push each element with the same probability in any position, how pop a sorted list out?
- ajay.raj December 17, 2017 in United States| Report Duplicate | Flag | PURGE
Google SDE1 - 1of 1 vote
AnswersDetermines whether two strings containing backspace keys are the same.
- ajay.raj December 17, 2017 in United States| Report Duplicate | Flag | PURGE
Google SDE1 - 1of 1 vote
Answersclass EncodingChecker {
- ajay.raj December 17, 2017 in United States
EncodingChecker (String pattern) {...} // constructor
boolean isEncoded (String s) {...} // for any string s, check whether s is encoded from pattern, see below
}
pattern = 'abcabc'
s = '123123' -> True
= 'cbzabc' -> False
= 'xyzxyz' -> True
Second question: If the pattern is not one but one million, how to write isEncoded?| Report Duplicate | Flag | PURGE
Google SDE1