Guest User

Untitled

a guest
Feb 12th, 2018
641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. for(int n: A){
  2.         if (n == a) cnt1++;
  3.         else if (n == b) cnt2++;
  4.         else if (cnt1 == 0){
  5.             cnt1++;
  6.             a = n;
  7.         }
  8.         else if (cnt2 == 0){
  9.             cnt2++;
  10.             b = n;
  11.         }
  12.         else{
  13.             cnt1--;
  14.             cnt2--;
  15.         }
  16.     }
Add Comment
Please, Sign In to add comment