Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbeb1d85

Browse files
authored
Merge pull requestneetcode-gh#2009 from thuanle123/0344-reverse-string
create 0344-reverse-string-csharp
2 parents131fc44 +d8ed917 commitbeb1d85

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎csharp/0344-reverse-string.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// While Loop Solution
2+
classSolution
3+
{
4+
publicvoidReverseString(char[]s)
5+
{
6+
intleftPointer=0;
7+
intrightPointer=s.Length-1;
8+
while(leftPointer<rightPointer)
9+
{
10+
chartemp=s[leftPointer];
11+
s[leftPointer++]=s[rightPointer];
12+
s[rightPointer--]=temp;
13+
}
14+
}
15+
}
16+
17+
// For Loop Solution
118
publicclassSolution
219
{
320
publicvoidReverseString(char[]s)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp