Flipkart Interview Question for Software Engineer / Developers






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

For singe elevator, we keep a global vector of floors in increasing order, such as a1 -> a2 -> a3 -> a4 -> a5 (1 -> 3 -> 4 -> 5 -> 7 -> 12), we also define 2 bit number as direction where 00 means idle, 01 means downward, 10 means upward, we also keep a global priority queue, where where ever some one from ai hold the button, then we calculate the distance based upon direction and highest or lowest floor number in current priority queue, and we insert that node into queue, we also keep a bit vector of size floor numbers, and if from some floor number someone hold button we set it to one, and when the elevator reach their we delete the entry from priority queue(topmost entry), set bitvector entry to false. this bitvector is used to avoid repeated entries at the same time from a same floor, this bit vector can be a hash function also when floor are not continuous.

- sonesh October 24, 2012 | 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