Facebook | Phone | Valid Palindrome & Sorted Iterator

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-08-01Added By Anonymous
Source: Link

Company: Meta (Facebook)
Role: unknown
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

45-50 mins of Online Interview - Coderpad.

First 5 mins: Introduction
40Min: Coding Round
Last 5 Mins: Asking any questions

The interview consist of 2 problems
1. https://leetcode.com/problems/valid-palindrome/
2. Sorted Iterator
Given N sorted array list, Implement a Data structure with hasNext() and next() in sorted order. 
e.g.  Input
 list 1 -> 4, 13, 17, 21, 85, 93
 list 2-> 2, 9
 list 3 -> 1, 5, 7, 18, 33

 Output
 next() -> 1
 next() -> 2
 next() -> 4
 next() -> 5
 hasNext() -> true;
 next() -> 7
 next() -> 9
 ....

 next() -> 93
 hasNext() -> false

Comments