Skip to content

[2주차] 조보근 | 5문제#20

Merged
bhy304 merged 2 commits intoKDT8DEV:mainfrom
P2P-J:bogeun
Sep 22, 2025
Merged

[2주차] 조보근 | 5문제#20
bhy304 merged 2 commits intoKDT8DEV:mainfrom
P2P-J:bogeun

Conversation

@P2P-J
Copy link
Copy Markdown
Contributor

@P2P-J P2P-J commented Sep 22, 2025

PR 체크리스트

  • 자세한 내용은 README.md 파일에서 확인하기

✅ 아래 규칙 한번더 확인해 주세요~!

  • 소스코드 파일 규칙 : 문제이름.js
  • commit 메시지 규칙 : 날짜 | 문제 이름 | 문제수
  • PR 규칙 : [N주차] 본인 이름 | 총 문제수

✅ 아래 항목을 충족하는지 확인해 주세요~!

  • Reviewers 설정 (본인을 제외한 스터디원)
  • Assignees 본인으로 설정
  • Labels 설정 (JavaScript,LV0,PGS 자동설정, 그외 라벨은 직접 추가)
    • 난이도 : LV0 ~ LV1
    • 언어 : JavaScript
    • 플랫폼 : PGS
    • (선택) 리뷰어들의 도움이 필요하거나 질문이 있을 경우, Help, Question 추가
  • PR 메시지 작성

문제풀이

📝 문제 풀이 관련 내용 작성

아 완주하지못한선수 멋있게하면 안되고 대충하니까 되버림..훌쩍

function solution(participant, completion) {
  participant.sort();
  completion.sort();

  for (let i = 0; i < participant.length; i++) {
    if (participant[i] !== completion[i]) {
      return participant[i];
    }
  }
}

문자열돌리기 라는 문제가 있는데,

문자열 str이 주어집니다.
문자열을 시계방향으로 90도 돌려서 아래 입출력 예와 같이 출력하는 코드를 작성해보세요. - 이런 문젠데, 새로운 것을 알게 되었어.

방법 1 (처음보는 for of 문)
 const readline = require("readline");
 const rl = readline.createInterface({
   input: process.stdin,
   output: process.stdout,
 });

 let input = [];
 let str = "";
 rl.on("line", function (line) {
   input = line;
 }).on("close", function () {
   for (str of input) {
     console.log(str);
   }
 });

for of 문 같은 문제들을 원래 [...index] 던가 for each로 많이 풀었는데, 새로운 함수? 방법을 알게되었닷! 저것도 코드가 간결해져서 좋은듯!@

@github-actions github-actions bot added JavaScript 언어 : JavaScript LV0 문제 난이도 LV0 PGS 프로그래머스 (Programmers) labels Sep 22, 2025
@bhy304 bhy304 merged commit 19c08b8 into KDT8DEV:main Sep 22, 2025
1 check passed
@bhy304 bhy304 linked an issue Sep 22, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

JavaScript 언어 : JavaScript LV0 문제 난이도 LV0 PGS 프로그래머스 (Programmers)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2주차] 완주하지 못한 선수

2 participants