151
-
[LeetCode] 151. Reverse Words in a StringLeetCode 2021. 10. 20. 13:31
https://leetcode.com/problems/reverse-words-in-a-string/ Reverse Words in a String - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Reverse Words in a String String이 주어졌을때, 공백으로 이를 분절해서 역으로 재배치하는 문제다. 공백이 여러개 있을 경우엔 하나만 출력하고, 맨 앞과 맨 뒤의 공백은 제거(trim)한다. 풀이는 아래와 같다. 가장 먼저 String을 역으로..