본문 바로가기

프로그래머스(코딩 테스트)

(68)
아이스 아메리카노 // javascriptconst solution = (money) => { return [Math.floor(money / 5500), money % 5500];}// typescriptconst solution = (money:number):number[] => { return [Math.floor(money / 5500), money % 5500];}
숫자 비교하기 // javascriptconst solution = (num1, num2) => { return num1 === num2 ? 1 : -1} // typescriptconst solution = (num1:number, num2:number):number => { return num1 === num2 ? 1 : -1}
두 수의 나눗셈 // javascriptconst solution = (num1, num2) => { return Math.floor(num1 / num2 * 1000) }// typescriptconst solution = (num1:number, num2:number):number => { return Math.floor(num1 / num2 * 1000) }
몫 구하기 // javascriptconst solution = (num1, num2) => { return Math.floor(num1 / num2)}// typescriptconst solution = (num1:number, num2:number):number => { return Math.floor(num1 / num2)}
두 수의 곱 // javascriptconst solution = (num1, num2) => { return num1 * num2}// typescriptconst solution = (num1:number, num2:number):number => { return num1 * num2}
중복된 숫자 개수 // javascriptconst solution = (array, n) => { return array.filter(item => item === n).length;} // typescriptconst solution = (array:number[], n:number):number => { return array.filter(item => item === n).length;}
머쓱이보다 키 큰 사람 // javascriptconst solution = (array, height) => { return array.filter(friendHeight => friendHeight > height).length;} // typescriptconst solution = (array:number[], height:number):number => { return array.filter(friendHeight => friendHeight > height).length;}
두 수의 차 // javascriptconst solution = (num1, num2) => { return num1 - num2} // typescriptconst solution = (num1:number, num2:number):number => { return num1 - num2}