Panda Guru LogoPanda
Guru

Lead Software Engineer | JP Morgan | Bangalore

Round 1

Questions:

  1. Asked question around saving Employee object as key in HashMap (hashcode + equals) - very easy.
  2. Asked one simple SQL query based on 2 tables Employee and Salary where I need to find employees which don’t have salary rows in the Salary table.
  3. Oral discussion around AWS Lambda (constraints of Lambda such as default max concurrency, max memory utilization, RDS, master-slave, read-write ratio, etc.).
  4. General System Design discussion over batch processing, etc.
Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.


Round 2

Questions:

  1. Interviewer asked me to write an SQL query where there is one employee table which has empid, name, managerid column. The managerid column has one of the employee ids (because managers are also employees). Write a query to print those manager names who have more than 5 subordinates.
  2. Upon failing to write the above query, he asked what if you have an ArrayList of Employees in Java and the Employee class has those 3 attributes id, name, managerid. Print manager name who has more than 5 subordinates.
-- SQL query to find manager names with more than 5 subordinates SELECT e1.name FROM Employee e1 JOIN Employee e2 ON e1.empid = e2.managerid GROUP BY e1.name HAVING COUNT(e2.empid) > 5;
Candidate's Approach

The code was simple to create a Map of managerid-employee list and for each manager check the size of the employee list. However, for returning the manager name, I was iterating over the employee list again, which the interviewer suggested I should avoid.

After the call, I realized he might have wanted me to create one more map of empId-EmpObject and use that map to get the manager name instead of iterating over the employee list again.

Interviewer's Feedback

No feedback provided.