Skip to content

Conversation

@haemin4738
Copy link
Collaborator

📌 문제 링크

프로그래머스 81031번 - 숫자 문자열과 영단어

screencapture-school-programmers-co-kr-learn-courses-30-lessons-81301-2025-07-08-09_54_23


📝 문제 개요

  • 숫자를 건넬 때 일부 자릿수를 영단어로 바꾼 카드를 건네주면 원래 숫자를 찾는 문제
  • 숫자의 일부 자릿수가 영단어로 바뀌어졌거나, 혹은 바뀌지 않고 그대로인 문자열 s가 매개변수로 주어집니다
  • s가 의미하는 원래 숫자를 return 하도록 solution 함수를 완성

🧩 풀이 과정 요약

풀이 1: Map 사용

  1. 주어진 숫자-영단어표를 참고해서 영단어를 Key로, 숫자를 value로 갖는 HashMap을 구성
  2. replaceAll을 통해 대체

풀이 2: HashMap 활용

  1. 영단어를 담는 String 타입의 배열 생성
  2. 반복문을 사용해 배열 안의 모든 영단어를 검사
  3. 문자열 s에 영단어가 있다면 replace를 사용해 변환

😁 결과

image

Copy link
Member

@Yoepee Yoepee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Collaborator

@jjuchan jjuchan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 좋은 것 같습니다

@Yoepee Yoepee merged commit b6f7753 into main Jul 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants