PornToken

Amazon IMDB coding test

Jan 17th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. FileName: Company.java
  2. import java.util.ArrayList;
  3. import java.util.List;
  4.  
  5. public class Company {
  6.  
  7. // IMPORTANT: DO NOT MODIFY THIS CLASS
  8. public static class Employee {
  9.  
  10. private final int id;
  11. private final String name;
  12. private List<Employee> reports;
  13.  
  14. public Employee(int id, String name) {
  15. this.id = id;
  16. this.name = name;
  17. this.reports = new ArrayList<Employee>();
  18. }
  19.  
  20. public int getId() {
  21. return id;
  22. }
  23.  
  24. public String getName() {
  25. return name;
  26. }
  27.  
  28. public List<Employee> getReports() {
  29. return reports;
  30. }
  31.  
  32. public void addReport(Employee employee) {
  33. reports.add(employee);
  34. }
  35. }
  36.  
  37. /*
  38. * Read the attached PDF for more explanation about the problem
  39. * Note: Don't modify the signature of this function
  40. * @param ceo
  41. *
  42. * @param firstEmployee
  43. *
  44. * @param secondEmployee
  45. *
  46. * @return common manager for both employees that is closest to them.
  47. */
  48. @SuppressWarnings("unused")
  49. public static Employee closestCommonManager(Employee ceo, Employee firstEmployee, Employee secondEmployee) {
  50. // Implement me
  51. return null;
  52. }
  53. };
Add Comment
Please, Sign In to add comment