Facebook | Phone | Count occurrences of a number in sorted array & Find the Celebrity
Anonymous User
4911

Position: E5
Location: NYC

I was asking following two questions

Question 1:
Find the number of occurrences of an element in a sorted array
I told in linear search its very easy and told it can be done in binary search as well.
Wrote the binary search and to expand on both sides of the array to get the count/

Question 2:
https://leetcode.com/problems/find-the-celebrity/ (premium)
Came with O(n^2) design but the interviewer asked O(n). I had never solved that problem before and found it tough to come with the solution in just 15 mins.

A week later I mailed the Recruiter for feedback and got back a standard rejection mail.

Comments (5)