Grokking Data Structures & Algorithms for Coding Interviews
Vote

0% completed

​

Solution: Apple Redistribution into Boxes

.....

.....

.....

Like the course? Get enrolled and start learning!
A

Anonymous

· 2 years ago

  1. Why are we sorting the capacities in ascending order and then iterating from the end? Why don't we just sort the capacities in descending order and iterate from the start? Seems simpler and less convoluted.
  2. Why is the space complexity O(n)? Shouldn't the space be O(m) since we are sorting the capacity (and not the apple) array?
Show 1 reply

Reading Progress

0%


Vote for new content