Sort [8, 7, 6, 5, 4, 3, 2, 1] ascending; print comma-separated.
| Test | Status | Details |
|---|
Ready — edit the code above and click Run or Submit.
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main()
{
int[] a = { 8, 7, 6, 5, 4, 3, 2, 1 };
Array.Sort(a);
Console.WriteLine(string.Join(",", a));
}
}
Try solving on your own first, then reveal the official answer.
Bubble sort — implement manually in interviews; Array.Sort for verification.