【Facebook面试经验】London|May, 2020|Unique elements in a sorted array & Clone Graph Facebook 电面 Onsite 开发岗

喵贵妃 2020-5-15 726


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

Graph {

vector<Node*> nodes ;

}

Node {

int val ;

vector<Node*> Neighbors ;

}

最后于 2020-6-1 被maomoke编辑 ,原因:
最新回复 (0)
返回