1710. Maximum Units on a Truck
Greedy
pick larger unit first, so sort by numberOfUnitsPerBoxi desc
ticky part is use left box number to gen the result (not like ่ๅ ๅ้ก, ๅชๆไธๅๅ , ้่ฃกๆๅคๅ็ด็ฎฑๅฏไปฅ็จ, ๆไปฅๅฏไปฅ็จ ่ฒชๅฟ๏ผ
time: O(nlogn)
space: O(1)
Previous1465. Maximum Area of a Piece of Cake After Horizontal and Vertical CutsNext767. Reorganize String
Last updated