Skip to content

Commit c9a3f2a

Browse files
Kevin Naughton JrKevin Naughton Jr
authored andcommitted
added directories for snapchat, yelp, and apple
1 parent 05e15bb commit c9a3f2a

File tree

6 files changed

+101
-0
lines changed

6 files changed

+101
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//Given an input string, reverse the string word by word.
2+
//For example,
3+
//Given s = "the sky is blue",
4+
//return "blue is sky the".
5+
6+
public class ReverseWordsInAString {
7+
public String reverseWords(String s) {
8+
String[] words = s.trim().split("\\s+");
9+
String result = "";
10+
for(int i = words.length - 1; i > 0; i--) {
11+
result += words[i] + " ";
12+
}
13+
14+
return result + words[0];
15+
}
16+
}
17+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//Given an input string, reverse the string word by word.
2+
//For example,
3+
//Given s = "the sky is blue",
4+
//return "blue is sky the".
5+
6+
public class ReverseWordsInAString {
7+
public String reverseWords(String s) {
8+
String[] words = s.trim().split("\\s+");
9+
String result = "";
10+
for(int i = words.length - 1; i > 0; i--) {
11+
result += words[i] + " ";
12+
}
13+
14+
return result + words[0];
15+
}
16+
}
17+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//Given an input string, reverse the string word by word.
2+
//For example,
3+
//Given s = "the sky is blue",
4+
//return "blue is sky the".
5+
6+
public class ReverseWordsInAString {
7+
public String reverseWords(String s) {
8+
String[] words = s.trim().split("\\s+");
9+
String result = "";
10+
for(int i = words.length - 1; i > 0; i--) {
11+
result += words[i] + " ";
12+
}
13+
14+
return result + words[0];
15+
}
16+
}
17+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//Given an input string, reverse the string word by word.
2+
//For example,
3+
//Given s = "the sky is blue",
4+
//return "blue is sky the".
5+
6+
public class ReverseWordsInAString {
7+
public String reverseWords(String s) {
8+
String[] words = s.trim().split("\\s+");
9+
String result = "";
10+
for(int i = words.length - 1; i > 0; i--) {
11+
result += words[i] + " ";
12+
}
13+
14+
return result + words[0];
15+
}
16+
}
17+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//Given an input string, reverse the string word by word.
2+
//For example,
3+
//Given s = "the sky is blue",
4+
//return "blue is sky the".
5+
6+
public class ReverseWordsInAString {
7+
public String reverseWords(String s) {
8+
String[] words = s.trim().split("\\s+");
9+
String result = "";
10+
for(int i = words.length - 1; i > 0; i--) {
11+
result += words[i] + " ";
12+
}
13+
14+
return result + words[0];
15+
}
16+
}
17+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//Given an input string, reverse the string word by word.
2+
//For example,
3+
//Given s = "the sky is blue",
4+
//return "blue is sky the".
5+
6+
public class ReverseWordsInAString {
7+
public String reverseWords(String s) {
8+
String[] words = s.trim().split("\\s+");
9+
String result = "";
10+
for(int i = words.length - 1; i > 0; i--) {
11+
result += words[i] + " ";
12+
}
13+
14+
return result + words[0];
15+
}
16+
}

0 commit comments

Comments
 (0)