Untitled

Run Settings
LanguageC#
Language Version
Run Command
using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { var exercises = new[] { 3, 2, 1 }; var count = 0; while (exercises.Length != 0) { exercises = ExcludeIncreasingSequence(exercises).ToArray(); count++; } Console.WriteLine(count); } static int max = 0; static IEnumerable<int> ExcludeIncreasingSequence(IEnumerable<int> sequence) { foreach (var value in sequence) { if (value != max + 1) yield return value; else max = value; } } }
Editor Settings
Theme
Key bindings
Full width
Lines