Algorithm/programmers
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ฌธ์์ด์ ์ ์๋ก ๋ฐ๊พธ๊ธฐ (JAVA)
๋น๋ฒ๋ฒ๋น
2021. 9. 30. 16:29
๐ ๋ฌธ์
๋ฌธ์์ด s๋ฅผ ์ซ์๋ก ๋ณํํ ๊ฒฐ๊ณผ๋ฅผ ๋ฐํํ๋ ํจ์, solution์ ์์ฑํ์ธ์.
๐ ํ์ด
class Solution {
public int solution(String s) {
return Integer.parseInt(s);
}
}
https://programmers.co.kr/learn/courses/30/lessons/12925
์ฝ๋ฉํ ์คํธ ์ฐ์ต - ๋ฌธ์์ด์ ์ ์๋ก ๋ฐ๊พธ๊ธฐ
๋ฌธ์์ด s๋ฅผ ์ซ์๋ก ๋ณํํ ๊ฒฐ๊ณผ๋ฅผ ๋ฐํํ๋ ํจ์, solution์ ์์ฑํ์ธ์. ์ ํ ์กฐ๊ฑด s์ ๊ธธ์ด๋ 1 ์ด์ 5์ดํ์ ๋๋ค. s์ ๋งจ์์๋ ๋ถํธ(+, -)๊ฐ ์ฌ ์ ์์ต๋๋ค. s๋ ๋ถํธ์ ์ซ์๋ก๋ง ์ด๋ฃจ์ด์ ธ์์ต๋
programmers.co.kr