I have to report a bug


  • 0
    public class Solution{
            static int C_order=0;
            public String LargestNumber(int[] num)
            {
                string rlt = "";
                string[] g=new string[num.Count()];
                for (int i = 0; i < num.Count(); i++)
                {
                    g[i] = num[i].ToString();
                }
                Array.Sort(g);
                Array.Reverse(g);
                g = SortOrder(g);
                    for (int i = 0; i < num.Count(); i++)
                    {
                        rlt +=  g[i];
                    }
                        return rlt;
            }
            public string[] SortOrder(string[] s)
            {
                string n = "";
                if(C_order<s.Count()-1)
                {
                    if (string.Compare(s[C_order+1] + s[C_order], s[C_order] + s[C_order+1]) > 0)
                    {
                        n = s[C_order];
                        s[C_order] = s[C_order + 1];
                        s[C_order + 1] = n;
                    }
                    C_order++;
                    SortOrder(s);
                }
                return s;
            }
    }
    

    There're my C# code. I test the same numbers for right output.
    But this system return the wrong output all the time.
    By the same logic idea, the code of c++ and java all got accepted.

    I just consider if there're any problem with C# compiler of this system?


  • 0
    M

    I found the same problem happened in JAVA


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.