목록프로그래머스 (34)
joyful

문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/120826 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 풀이 function solution(my_string, letter) { let string = my_string.split(""); //[ 'h', 'e', 'l', 'l', 'o' ] let answer = ""; for (i = 0; i < my_string.length; i++) { if (string[i] !== letter) { //해당 철자가 없으면 answer에 ..

문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/120825 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 풀이 function solution(my_string, n) { let letter = my_string.split(""); //[ 'h', 'e', 'l', 'l', 'o' ] let answer = ""; for (i = 0; i < my_string.length; i++) { for (j = 0; j < n; j++) { answer += letter[i]; } } ret..

문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/120824 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 풀이 function solution(num_list) { let even = 0; let odd = 0; for (let i = 0; i < num_list.length; i++) { if (num_list[i] % 2 == 1) { //나머지가 1이면 홀수 odd += 1; //result = result + i } else { even += 1; } } return (ans..

문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/120823 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 풀이 const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); let input = []; rl.on('line', function (line) { input = line.split(' '); }).on('close..

문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/120822 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 풀이 function solution(my_string) { let reverseText = my_string.toString().split(''); //typeof : object let result = reverseText.reverse().join(''); //typeof : string //join()을 사용해서 split 되어있던 배열 객체를 string으로 바꿔줘야 정..

문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/120821 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 풀이 function solution(num_list) { return num_list.reverse(); } reverse(): 배열의 순서를 뒤집는 메서드

문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/120820 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 풀이 function solution(age) { return 2022 - age + 1; } 만약 올해를 기준으로 삼는다면 아래와 같이 풀 수도 있겠다! function solution(age) { return new Date().getFullYear() - age + 1; } getFullYear(): 주어진 날짜의 현지 시간 기준 연도를 반환하는 메서드

문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/120819 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 풀이 function solution(money) { let price = 5500; let coffee = Math.floor(money / price); //몫 let balance = money % price; //나머지 let answer = [coffee,balance]; return answer; } 다른 사람 풀이 function solution(money) { re..

문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/120818 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 풀이 function solution(price) { if (price >= 500000) { return Math.floor(price * 0.8) } else if (price >= 300000) { return Math.floor(price * 0.9) } else if (price >= 100000) { return Math.floor(price * 0.95) } else..

문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/120817 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 풀이 function solution(numbers) { let sum = 0; for (i = 0; i < numbers.length; i ++) { sum += numbers[i]; //배열의 합계 얻기 } let answer = sum / numbers.length return answer; }