Bus Passenger Count

A city bus conductor is recording the number of passengers seated at each of the stops on a route. Given the passenger counts at each stop, count how many times the bus was completely empty (0 passengers).

A city bus conductor is recording the number of passengers seated at each of the stops on a route. Given the passenger counts at each stop, count how many times the bus was completely empty (0 passengers).

Input formatLink to this section

  • Line 1: An integer N representing the number of stops
  • Line 2: N space-separated integers representing the passenger counts

Output formatLink to this section

  • Line 1: The number of times the count was zero as a single integer

ConstraintsLink to this section

  • 1 <= N <= 100
  • 0 <= count <= 50

tip

Traverse the array and increment a counter each time you encounter the value 0.

Rate this content

Sign in to rate

Discussion

Sign in to join the discussion