Grokking the Coding Interview: Patterns for Coding Questions
Vote

0% completed

​

Solution: Tasks Scheduling Order

.....

.....

.....

Like the course? Get enrolled and start learning!
A

Anonymous

· 2 years ago

for

6

[[2,5],[0,5],[0,4],[1,4],[3,2],[1,3]]

I generated [0, 1, 2, 3, 4, 5] I got an error the validator expects the same particular order which is wrong!!

Show 2 replies
A

Anonymous

· 4 years ago

I don't think this algorithm is correct, at least it doesn't pass tests when I try it this way and doesn't match Kahn's as I understand it. I think this should be:

graph.get(child).add(parent); // put the parent into it's child's list inDegree.put(parent, inDegree.get(parent) + 1); // increment parent's inDegree

...and likewise on the subsequent problems.

Show 3 replies

Reading Progress

0%


Vote for new content