You are viewing a single comment's thread. Return to all comments →
void minimumBribes(vector<int> q) { int bride=0; int i=0; for(i=0;i<q.size()-1;i++){ int temp=0; for(int j=i+1;j<q.size();j++) { if(q[i] > q[j]){ temp++; } if(temp > 2) { cout<<"Too chaotic"<<endl; break; } } if(temp > 2) { break; } bride=bride+temp; } if(i==q.size()-1) cout<<bride<<endl;
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 →