Facebook | Phone | Unique elements in a sorted array & Clone Graph
Anonymous User
10781

Location: London
Date: May 2020

Question 1:
Count the unique elements in an Sorted Array.

Example:

Input: [1, 1, 1, 1, 2, 2, 2, 2, 5, 5, 5, 7, 7, 8, 8, 10]
Output = 6 

Provided O(n) solution with constant O(1) space.
Couldn't come up with any logn approach :(

Question 2:
Variation of https://leetcode.com/problems/clone-graph/
Graph Class was provided with vector<Node*>

Graph {
	vector<Node*> nodes ;
}

Node {
	int val ;
	vector<Node*> Neighbors ;
}

Gave DFS solution, but time almost ran out.. :(

Update 1:
Work Experience : 4 yrs.
Position : Software Engineer...level not decided..But I am SDE 3.

I didn't heard from them.
How long does they take to revert back ?

Comments (38)