Google Phone Screening L4

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-06-16Added By Anonymous
Source: Link

Company: Google
Role: L4
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

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.

Comments