Skip to content

Instantly share code, notes, and snippets.

@akinyeleolubodun
akinyeleolubodun / reverse_words_in_a_string.md
Last active December 6, 2016 15:56
Reverse Words in a String
public class Solution {
    public String reverseWords(String s) {
        s = s.trim();
        
        List<String> spl = split(s);
        StringBuilder sb = new StringBuilder();

        for(int i = spl.size() - 1; i >= 0; i--) {
 sb.append(spl.get(i));