Google Phone Screening L4

google logo
google
SDE II
June 16, 20254 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.

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)

Q1
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.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

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