google logo
Google· SDE II

Google Phone Screening L4

Posted
16 Jun 2025
379 reads

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.

How it went

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.

Questions asked (1)

  1. 01

    Tree String Decoder Iterator

    Data Structures & Algorithms

    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.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Google recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!