Advertisement
DPELED

2016a_87que2

Feb 24th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.31 KB | None | 0 0
  1.  public static int passingCars(int[] a)
  2.     {
  3.         int count = 0;
  4.         int howManyEastTillNow = 0;
  5.         for(int i = 0; i < a.length; i++)
  6.             if(a[i] == 0)
  7.                 howManyEastTillNow++;
  8.             else//a[i] = 1
  9.                 count += howManyEastTillNow;
  10.         return count;
  11.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement