목록JS Algorithm (22)
조이:)
내가한 답 function solution(message) { var answer = 0; let leng = message.length; if(leng >=1 && leng { return message.split('').length * 2 } split() 사용하기 Note: 빈 문자열이 주어졌을 경우 split()은 빈 배열이 아니라 빈 문자열을 포함한 배열을 반환합니다. 문자열과 separator가 모두 빈 문자열일 때는 빈 배열을 반환합니다. https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/String/split String.prototype.split() - JavaScript | MDN split() ..
내가한 답 🧚🏻알고가기! function solution(num_list) { var answer = [0,0]; for(let a of num_list){ answer[a%2] += 1 } return answer; }
내가한 답 function solution(n) { var answer = 0; var ea = n; var pzPiece = 7; var pizza = ea/pzPiece; if(ea>=1 && ea Math.ceil(n / 7) var solution=n=>~~(n/7)+!!(n%7)
문제 설명 머쓱이는 학교에서 키 순으로 줄을 설 때 몇 번째로 서야 하는지 궁금해졌습니다. 머쓱이네 반 친구들의 키가 담긴 정수 배열 array와 머쓱이의 키height가 매개변수로 주어질 때, 머쓱이보다 키 큰 사람 수를 return 하도록 solution 함수를 완성해보세요. 제한 사항 1 ≤ array의 길이 ≤ 100 1 ≤ height ≤ 200 1 ≤ array의 원소 ≤ 200 입출력 예 array height result [149, 180, 192, 170] 167 3 [180, 120, 140] 190 0 입출력 예 설명 입출력 예 #1 149, 180, 192, 170 중 머쓱이보다 키가 큰 사람은 180, 192, 170으로 세 명입니다. 입출력 예 #2 180, 120, 140 중 ..
문제 설명 머쓱이네 양꼬치 가게는 10인분을 먹으면 음료수 하나를 서비스로 줍니다. 양꼬치는 1인분에 12,000원, 음료수는 2,000원입니다. 정수 n과 k가 매개변수로 주어졌을 때, 양꼬치 n인분과 음료수 k개를 먹었다면 총얼마를 지불해야 하는지 return 하도록 solution 함수를 완성해보세요. 제한사항 0 0 && n=0 && ser