Why Expected has 4 rows in Department?


  • 0
    K

    Input:
    {"headers": {"Employee": ["Id", "Name", "Salary", "DepartmentId"], "Department": ["Id", "Name"]}, "rows": {"Employee": [[1, "Joe", 60000, 1], [2, "Ralph", 50000, 1], [3, "Joel", 60000, 1], [4, "Tracy", 75000, 1]], "Department": [[1, "IT"]]}}

    Output:
    {"headers": ["Department", "Employee", "Salary"], "values": [["IT", "Tracy", 75000], ["IT", "Joe", 60000], ["IT", "Joel", 60000]]}

    Expected:
    {"headers": ["Department", "Employee", "Salary"], "values": [["IT", "Tracy", 75000], ["IT", "Joe", 60000], ["IT", "Joel", 60000], ["IT", "Ralph", 50000]]}

    I think the Output is right, and the Expected is wrong....


  • 0
    L

    Same error here. I think OJ got it wrong.


  • 0
    L

    See #178 Rank Scores for ranking rules, it should be

    +-------+------+
    | Score | Rank |
    +-------+------+
    | 4.00  | 1    |
    | 4.00  | 1    |
    | 3.85  | 2    |
    | 3.65  | 3    |
    | 3.65  | 3    |
    | 3.50  | 4    |
    +-------+------+
    

  • 1
    S

    They are ranking by top 3 salaries per department, not top 3 salary earners per department. To make my statement less confusing, if employee/salary combinations in a department are A/4, B/4, C/2, D/2, E/3, F/1

    Top 3 salaries are 4, 3, 2

    Hence personnell earning top 3 salaries are A, B, C, D, E


  • 0
    P

    I think you're just not understanding the problem. The problem is asking for the employees with the top 3 salaries. What are the top 3 salaries? The top 3 salaries are 75000, 60000 and 50000. Employees Joe and Joel have the same Salary, they're tied for 2nd top Salary, therefore Ralph is 3rd top salary


  • 0
    T

  • 0

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.