프로그래머스

프로그래머스/Lv. 0 코딩 기초 트레이닝

[프로그래머스] 코딩 기초 트레이닝 Day 3 / JS

1. 문자열 섞기 [문제 설명] 길이가 같은 두 문자열 str1과 str2가 주어집니다. 두 문자열의 각 문자가 앞에서부터 서로 번갈아가면서 한 번씩 등장하는 문자열을 만들어 return 하는 solution 함수를 완성해 주세요. [답변] function solution(str1, str2) { let answer=""; for(let i=0; i= 2*a*b ? Number(`${a}${b}`) : 2*a*b; }

프로그래머스/Lv. 0 코딩 기초 트레이닝

[프로그래머스] 코딩 기초 트레이닝 Day 2 / JS

1. 덧셈식 출력하기 [문제 설명] 두 정수 a, b가 주어질 때 다음과 같은 형태의 계산식을 출력하는 코드를 작성해 보세요. [답변] 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', function () { console.log(`${input[0]} + ${input[1]} = ${Number(input[0])+Number(input[1])}`); }); [답변2] cons..

프로그래머스/Lv. 0 코딩 기초 트레이닝

[프로그래머스] 코딩 기초 트레이닝 Day 1 / JS

1. 문자열 출력하기 [문제 설명] 문자열 str이 주어질 때, str을 출력하는 코드를 작성해 보세요. [제한사항] 1 ≤ str의 길이 ≤ 1,000,000 str에는 공백이 없으며, 첫째 줄에 한 줄로만 주어집니다. [답변] const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); let input = []; rl.on('line', function (line) { input = [line]; }).on('close',function(){ str = input[0]; console.log(str); }); [답변 2] const rea..

안댕이
'프로그래머스' 카테고리의 글 목록 (24 Page)