Google Phone Screening L4

Anonymous User
1970
Jun 16, 2025

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 next();
boolean hasNext();
}

Here next() returns the next character of decoded String.
hasNext() returns true if there are more characters in the decoded string.

Comments (6)