Skip to content
Discussion options

You must be logged in to vote

More idiomatic Fusion code would be this:

public class Test {
    public static List<List<int>()>() Sort(List<List<int>()> input) {
        List<List<int>()>() output;
        foreach (List<int> inner in input) {
            output.Add();
            List<int>! sorted = output.Last();
            sorted.AddRange(inner);
            // simple insertion sort descending
            for (int a = 1; a < sorted.Count; a++) {
                int key = sorted[a];
                int b = a - 1;
                while (b >= 0 && sorted[b] < key) {
                    sorted[b + 1] = sorted[b];
                    b--;
                }
                sorted[b + 1] = key;
            }
        }

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by c-gummo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants