Google Interview Question for Software Engineers
- 2of 2 votes
Implement an iterator<WordAndCount> which takes iterator<String> and its next() method returns the count for same word in a row. I was also asked to implement hasNext method.- Desi May 03, 2019 in United States
WordAndCount class had two properties:
I was asked to implement hasNext() and next() method which basically returns a WordAndCount object.
To make it clear, following is the example:
lets say Iterator<String> has following values:
iterator<WordAndCount> next() method should return this:
It seemed like an easy problem and because we ran out of time during coding i think interviewer didn't ask me the follow up question. Interviewer was nice and he told me he doesn't expect me to code in time limit but he only wants to see how i approach the problem.
| Report Duplicate | Flag | PURGE
Google Software Engineer
Interview Type: Phone Interview
Open Chat in New Window