[LeetCode] 1431. Kids With the Greatest Number of Candies, Easy
·
CodingTest/LeetCode
1. 문제n명의 학생이 가지고 있는 사탕의 수를 나타내는 배열 candies와 남은 사탕 extraCandies가 주어질 때, 각 학생에게 extraCandies를 준 뒤 학생들 중 가장 많은 사탕의 수이면 true를 담고 아니면 false를 담아 반환하라.2. 해결function kidsWithCandies(candies: number[], extraCandies: number): boolean[] { let max = Number.MIN_SAFE_INTEGER; const ans = [] for(const candy of candies) max = Math.max(max, candy); for(const candy of candies) { if(candy + extr..