Skip to content

Commit 25bc6f4

Browse files
Added String Problem-Solution
Co-authored-by: Ashish Kumar Singh <ashishk.singh1008@gmail.com> Co-authored-by: Laxman Singh Koranga <laxmankoranga03@gmail.com>
1 parent 164a647 commit 25bc6f4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Java/String/ReverseString.java

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* PROBLEM: 344: Reverse String
3+
*/
4+
public class ReverseString {
5+
public void reverseString(char[] s) {
6+
int start = 0;
7+
int end = s.length - 1;
8+
while (start < end) {
9+
char temp = s[start];
10+
s[start++] = s[end];
11+
s[end--] = temp;
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)