Interview Question for Applications Developers


Country: India




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

select Name from EMPLOYEE where Dept=(select Dept from (select sum(Dept),Dept from EMPLOYEE group by Dept order by 1 desc limit 1));

- AJit A September 19, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

SELECT e.name FROM Employee e
INNER JOIN
(
SELECT depId, count(*) FROM Employee GROUP BY depId ORDER BY 2 DESC LIMIT 1
) t ON t.depId = e.depId

- Murali Mohan September 19, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

LOL.

- Anonymous September 19, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Hash[Dept_Name] = Num_Employees
Hash[Employee_Name]=Dept_Name

Now, search for the Dept_Name with highest Employee Number. Then, return all those employees in the second hash table that work in that department. This is an O(n) approach.
We can maintain a Max_Heap where keys are the Num_Employees and values are Dept_Name and then return all employees that work in the Dept corresponding to the root of the Max_Heap.

- Anonymous September 20, 2013 | 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