Assign Cookies LeetCode solution in JavaScript
1var findContentChildren = function (g, s) {2g.sort(function (a, b) {3return b - a;4});5s.sort(function (a, b) {6return a - b;7});89let content = 0;10for (let curG of g) {11for (let curS of s) {12if (curS >= curG) {13s.pop();14content++;15break;16}17}18}1920return content;21};