ReverseString, a C# interview-question

前端 未结 12 1869
予麋鹿
予麋鹿 2021-01-31 06:15

I had an interview question that asked me for my \'feedback\' on a piece of code a junior programmer wrote. They hinted there may be a problem and said it will be used heavily o

12条回答
  •  爱一瞬间的悲伤
    2021-01-31 07:16

     static string reverseString(string text)
        {
            Char[] a = text.ToCharArray();
            string b = "";
            for (int q = a.Count() - 1; q >= 0; q--)
            {
                b = b + a[q].ToString();
            }
            return b;
        }
    

提交回复
热议问题