Easy solution by JOIN & GROUP BY in MySQL beats 72.88% runtimes & 100% memory
```\nSELECT \n\te2.departmentname AS Department,\n    e1.name AS Employee,\n    e1.salary AS Salary \nFROM employee e1 JOIN \n(\n\tSELECT \t\n\t\te.departmentid
```\nSELECT \n\te2.departmentname AS Department,\n    e1.name AS Employee,\n    e1.salary AS Salary \nFROM employee e1 JOIN \n(\n\tSELECT \t\n\t\te.departmentid, \n        d.name AS departmentname, \n        max(e.salary) AS maxsalary \n    FROM employee e JOIN department d ON e.departmentid = d.id \n\tGROUP BY e.departmentid\n) e2 ON e1.salary = e2.maxsalary AND e1.Departmentid = e2.departmentid;
['MySQL']