Given an integer array and an integer , return the most frequent elements. You may return the answer in any order.
Constraints:
Follow up:
Your algorithm's time complexity must be better than , where n is the array's size.
There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [, ] indicates that you must take course first if you want to take course .
Return the ordering of courses you should take to finish all courses. If there are many valid answers, return any of them. If it is impossible to finish all courses, return an empty array.