C# solution part 1.
Execution time: 0ms, 235 ticks, the quickest so far :)
usingSystem;usingSystem.Collections.Generic;usingSystem.Diagnostics;usingSystem.IO;usingSystem.Linq;usingSystem.Text;namespaceAdventOfCode2020{staticclassDay10{staticintcounterDif1=0;staticintcounterDif3=0;staticList<int>input;publicstaticvoidExecute(){input=File.ReadAllLines("//inputfile.txt").Select(r=>int.Parse(r)).ToList();//Added a imer just for funvartimer=newStopwatch();timer.Start();input.Insert(0,0);input.Sort();for(inti=input.Count-1;i>=1;i--){vardif=input[i]-input[i-1];if(dif==1)counterDif1++;elseif(dif==3)counterDif3++;elsethrownewException($"{dif}");}//Finally add the last adapter to your devicecounterDif3++;timer.Stop();Console.WriteLine($"1 jolts difference: {counterDif1} ");Console.WriteLine($"3 jolts difference: {counterDif3} ");Console.WriteLine($"1-jolts multiplied by 3-jolts: {counterDif1 * counterDif3}");Console.WriteLine($"Executed in: {timer.ElapsedMilliseconds} milliseconds, {timer.ElapsedTicks} ticks");}}}
`
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
C# solution part 1.
Execution time: 0ms, 235 ticks, the quickest so far :)
`