Problem Solution/Programmers

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค/JS] ๋‚˜๋จธ์ง€ ๊ตฌํ•˜๊ธฐ

yuri lee 2023. 8. 25. 19:53
๋ฐ˜์‘ํ˜•

Problem Description

์ •์ˆ˜ num1, num2๊ฐ€ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ฃผ์–ด์งˆ ๋•Œ, num1๋ฅผ num2๋กœ ๋‚˜๋ˆˆ ๋‚˜๋จธ์ง€๋ฅผ return ํ•˜๋„๋ก solution ํ•จ์ˆ˜๋ฅผ ์™„์„ฑํ•ด์ฃผ์„ธ์š”.

 

Restrictions

  • 0 < num1 ≤ 100
  • 0 < num2 ≤ 100

 

Input/Output Example

  • ์ž…์ถœ๋ ฅ ์˜ˆ #1 num1์ด 3, num2๊ฐ€ 2์ด๋ฏ€๋กœ 3์„ 2๋กœ ๋‚˜๋ˆˆ ๋‚˜๋จธ์ง€ 1์„ return ํ•ฉ๋‹ˆ๋‹ค.
  • ์ž…์ถœ๋ ฅ ์˜ˆ #2 num1์ด 10, num2๊ฐ€ 5์ด๋ฏ€๋กœ 10์„ 5๋กœ ๋‚˜๋ˆˆ ๋‚˜๋จธ์ง€ 0์„ return ํ•ฉ๋‹ˆ๋‹ค.

 

My solution

const solution = (num1, num2) => num1%num2

 


Reference: https://school.programmers.co.kr/learn/courses/30/lessons/120810

 

๋ฐ˜์‘ํ˜•