public int[] findOrder(int numCourses, int[][] prerequisites) {
		if (numCourses <= 0) {
			return new int[] {};
		}
		int[] result = new int[numCourses];
		int index = 0;
		Map<Integer, List<Integer>> graph = new HashMap<Integer, List<Integer>>();
		Map<Integer, Integer> in = new HashMap<Integer, Integer>();
		for (int i = 0; i < numCourses; i++) {
			in.put(i, 0);
			graph.put(i, new LinkedList<Integer>());
		}
		for (int edge[] : prerequisites) {
			graph.get(edge[1]).add(edge[0]);
			in.put(edge[0], in.get(edge[0]) + 1);
		}
		Queue<Integer> queue = new LinkedList<Integer>();
		for (int k : in.keySet()) {
			if (in.get(k) == 0) {
				queue.add(k);
			}
		}
		while (!queue.isEmpty()) {
			int p = queue.poll();
			result[index] = p;
			index++;
			for (int s : graph.get(p)) {
				in.put(s, in.get(s) - 1);
				if (in.get(s) == 0) {
					queue.add(s);
				}
			}
		}

		if (index != numCourses) {
			return new int[] {};
		}
		return result;
	}