You are viewing a single comment's thread. Return to all comments →
C#
public static void minimumBribes(List<int> q) { int bribecount=0; for(int i=0 ;i< q.Count();i++) { int bribe = q[i] - (i+1); if( bribe >2) { Console.WriteLine("Too chaotic"); return; } for (int j = Math.Max(0, q[i] - 2); j < i; j++) { if (q[j] > q[i]) { bribecount++; } } } Console.WriteLine(bribecount); } }
Seems like cookies are disabled on this browser, please enable them to open this website
New Year Chaos
You are viewing a single comment's thread. Return to all comments →
C#