Today's challenge comes from aryan-firouzian on Codewars. You are to figure out how many people are on the bus given the following scenario:
There is a bus moving in the city, and it takes and drop some people at each bus stop.
You are provided with a list (or array) of integer arrays (or tuples). Each integer array has two items which represent the number of people that get on the bus (The first item) and the number of people that get off the bus (The second item) at a bus stop.
Your task is to return number of people who are still left on the bus after the last bus station (after the last array).
Good luck, and happy coding!
Want to propose a challenge for a future post? Email email@example.com with your suggestions!
When reasoning about algorithm performance we often look at complexity. Computer architecture however, might matter just as much and can influence the runtime of your implementation in orders of magnitude.