Please enable / Bitte aktiviere JavaScript!
Veuillez activer / Por favor activa el Javascript![ ? ]
Why my version is incorrect? - Q&A

Why my version is incorrect?

0 like 0 dislike
There is a website - and there the job "we Need to make so that the transmitted string is displayed backwards".
Here is my code:
public static string FirstReverse(string str) { int count = str.Length; string newstr="; while (count != 0) { newstr += str[count-1]; count--; } str = newstr; return str; }

And output the result I do the input string is displayed backwards, but the system thought that my code is incorrect and after inspection in their service truncated the last character.
I use Visual Studio 2017 and I am doing great. What's the catch?
asked by | 26 views

3 Answers

0 like 0 dislike
You have a different code. In the Studio int count = str.Length; and the site - int count = str.Length-1;
answered by
0 like 0 dislike
Why? There is a ToCharArray and Reverse.

Console.WriteLine(ReverseString("Hello, world!")); static string ReverseString(string value) { return new string(value.ToCharArray().Reverse().ToArray()); }
answered by
0 like 0 dislike
The bug, refresh the page tried? Can remember the old solution?
answered by
Welcome to Bug-code Q&A, where you can ask questions and receive answers from other members of the community.

24.8k questions

46.2k answers


12.7k users

24,788 questions
46,220 answers
12,715 users