EMC Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

Given: array is of integers.

- newGeek June 03, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This has been already discussed , we can do it with the help of Hash Map...with a complexity of o(1)

- Anonymous June 09, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Hi,
can you please share link to the solution. I could not figure out o(1) solution. Are you sure about that? Isnt it o(log n)?

- Algos_are_fun June 17, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

move in the step of power of ...
2,4,8, 16, 32,.. --> 2^i
moment u find a number less then or equal the required number stop.
if(num <= arr[2^i])
break
Apply binary search between the current index 2^i and 2^(i-1)

solution O(log n)

- Anonymous August 21, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

but i think he wants the first occurrence of the number.
so i think we need to apply binary search to find the number and then move left or right to find the first occurrence.

- Guest May 01, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

moron piece of shit solution

- Anonymous September 20, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

yeah ...the above solution is much better than hashing as hashing takes a preprocessing time of O(n) and space complexity of O(n) .

- Anonymous August 30, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Why 2^i ? please explain.

- Anonymous November 26, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We can directly apply binary search on this array because it is sorted.
Suppose an sorted array A[1..n].
In every step of binary search, we don't return if A[mid]==key.
Instead, we use this conditional statement:
if (key<=A[mid]) high=mid-1
else low=mid+1.
At last, we return value of low when low>high;
Time complexity is O(logN);

- Hong Sun September 06, 2011 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More