LeetCode – Reverse Words in a String (Java)

Given an input string, reverse the string word by word. For example, given s = “the sky is blue”, return “blue is sky the”. Java Solution This problem is pretty straightforward. We first split the string to words array, and then iterate through the array and add each element to a new string. Note: StringBuilder … Read more