Hi,
Can you please tell how to rewrite this code to D?

using System;
using System.Linq;
class Sort
{
    static void Main()
    {
int[] arr = { 7, 5, 7, 3, 3, 5, 3, 3, 0, 3, 1, 1, 5, 1, 1, 1, 2, 2, 8, 5, 8, 8 }; Console.WriteLine(string.Join(" ", arr.OrderByDescending(x => arr.Count(y => y == x)).ThenBy(x => x)));
        // prints 1 1 1 1 1 3 3 3 3 3 5 5 5 5 8 8 8 2 2 7 7 0
    }
}

I want to sort the array in descending order of the number of elements in ascending order of elements.

Reply via email to