package
0.0.0-20241220224003-b7cf03a90b2b
Repository: https://github.com/szhou12/leetcode-go.git
Documentation: pkg.go.dev
# README
455. Assign Cookies
Solution idea
My Solution - Greedy Algorithm 基础题
-
sort each array in increasing order
-
assign a pointer to each array
- 满足条件,两个指针都移动一格,count+=1
- 不满足,只移动 cookie-size 指针
Time complexity = $O(n\log n)$