Study the algorithm:
http://codereview.stackexchange.com/questions/118816/hacker-rank-jesse-and-cookies
Study C# priority queue implementation:
https://www.codeproject.com/articles/126751/priority-queue-in-csharp-with-help-of-heap-data-st.aspx
Read the discussion forum on HackerRank:
https://www.hackerrank.com/challenges/jesse-and-cookies/forum
Discussions:
1. Use two heaps to handle the input, simulate a priority queue.
Study Java code:
https://gist.github.com/jianminchen/c34720a91e761163d73c9f1d90cdb065
C# PriorityQueue - using array to build a minHeap, the idea is here:
https://www.hackerrank.com/challenges/jesse-and-cookies/forum/comments/119020
Review this one - using array to maintain the min-heap
http://codereview.stackexchange.com/questions/68530/minheap-implementation
Heap implementation in C#:
http://codereview.stackexchange.com/questions/131397/heap-implementation-in-c?rq=1
Practice and will make it a PriorityQueue later, add push/ pop method:
https://gist.github.com/jianminchen/e2f95c9564ccc34b7011a9a4edf55d96
No comments:
Post a Comment