-
🎵 557. Reverse Words in a String III javaLeetCode_Study_Plan/Algorithm 2022. 12. 20. 23:47
https://leetcode.com/problems/reverse-words-in-a-string-iii/
class Solution { public String reverseWords(String s) { String[] strs = s.split(" "); StringBuffer sb = new StringBuffer(); for(String str: strs){ StringBuffer temp = new StringBuffer(str); sb.append(temp.reverse()); sb.append(" "); } sb.setLength(sb.length()-1); return sb.toString(); } }
'LeetCode_Study_Plan > Algorithm' 카테고리의 다른 글
🎵 19. Remove Nth Node From End of List java (0) 2022.12.21 876. Middle of the Linked List java (0) 2022.12.21 344. Reverse String java (0) 2022.12.20 167. Two Sum II - Input Array Is Sorted java (0) 2022.12.20 283. Move Zeroes java (0) 2022.12.20