Google Phone Screening L4
Summary
I experienced a Google Phone Screening for an L4 role where I was asked to implement an iterator for decoding a string based on a given tree structure.
Full Experience
given a string and a tree to decode the string
Example -
s = "ABGHBCDDE"
()-> A -> B -> G -> H "Hello"
-> B -> C -> D " "
-> D -> E "there"
Write a class implementing below interface
public interface Iterator<Character> {
Character next();
boolean hasNext();
}
Here next() returns the next character of decoded String.
hasNext() returns true if there are more characters in the decoded string.
Interview Questions (1)
Given a string and a tree to decode the string.
Example -
s = "ABGHBCDDE"
()-> A -> B -> G -> H "Hello"
-> B -> C -> D " "
-> D -> E "there"
Write a class implementing below interface
public interface Iterator<Character> {
Character next();
boolean hasNext();
}
Here next() returns the next character of decoded String.
hasNext() returns true if there are more characters in the decoded string.