The result matching is wrong. I compare the result in VS


#1

My solution is:

class Solution {
    public List<List<int>> subsets(List<int> A) {
        A.Sort();

        var result = getSubSets(A);

        result.Sort((a, b) =>
        {
            var ai = 0;
            var bi = 0;

            while (ai < a.Count && bi < b.Count)
            {
                var c = a[ai++].CompareTo(b[bi++]);
                if (c != 0) return c;
            }

            return ai < a.Count ? 1 : -1;
        });

        return result;
    }

    static List<List<int>> getSubSets(List<int> A)
    {
        var result = new List<List<int>>();

        if (A.Count == 0)
            result.Add(new List<int>());
        else
        {
            var last = A.Last();
            var subs = getSubSets(A.Where(x => x != last).ToList());
            result.AddRange(subs);

            subs.ForEach(x => {
                var list = new List<int>();
                list.AddRange(x);
                list.Add(last);
                result.Add(list);
            });
        }

        return result;
    }
}

I am gething this issue but as you can see in the next image [6 20 ] comes before [13 ] in my result; (running in vs)