Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FileName: Company.java
- import java.util.ArrayList;
- import java.util.List;
- public class Company {
- // IMPORTANT: DO NOT MODIFY THIS CLASS
- public static class Employee {
- private final int id;
- private final String name;
- private List<Employee> reports;
- public Employee(int id, String name) {
- this.id = id;
- this.name = name;
- this.reports = new ArrayList<Employee>();
- }
- public int getId() {
- return id;
- }
- public String getName() {
- return name;
- }
- public List<Employee> getReports() {
- return reports;
- }
- public void addReport(Employee employee) {
- reports.add(employee);
- }
- }
- /*
- * Read the attached PDF for more explanation about the problem
- * Note: Don't modify the signature of this function
- * @param ceo
- *
- * @param firstEmployee
- *
- * @param secondEmployee
- *
- * @return common manager for both employees that is closest to them.
- */
- @SuppressWarnings("unused")
- public static Employee closestCommonManager(Employee ceo, Employee firstEmployee, Employee secondEmployee) {
- // Implement me
- return null;
- }
- };
Add Comment
Please, Sign In to add comment