We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 131fc44 + d8ed917 commit beb1d85Copy full SHA for beb1d85
csharp/0344-reverse-string.cs
@@ -1,3 +1,20 @@
1
+// While Loop Solution
2
+class Solution
3
+{
4
+ public void ReverseString(char[] s)
5
+ {
6
+ int leftPointer = 0;
7
+ int rightPointer = s.Length - 1;
8
+ while (leftPointer < rightPointer)
9
10
+ char temp = s[leftPointer];
11
+ s[leftPointer++] = s[rightPointer];
12
+ s[rightPointer--] = temp;
13
+ }
14
15
+}
16
+
17
+// For Loop Solution
18
public class Solution
19
{
20
public void ReverseString(char[] s)
0 commit comments