1/** 2 * @param {number[]} candies 3 * @return {number} 4 */ 5var distributeCandies = function(candies) { 6 const types = new Set(candies).size; 7 8 return Math.min(types, candies.length / 2) 9};
本文共 257 字,大约阅读时间需要 1 分钟。
1/** 2 * @param {number[]} candies 3 * @return {number} 4 */ 5var distributeCandies = function(candies) { 6 const types = new Set(candies).size; 7 8 return Math.min(types, candies.length / 2) 9};
转载于:https://www.cnblogs.com/rencoo/p/10137729.html