People Left on the Bus

Imagine a bus route where people get on and off at every stop. Write number, which takes a list stops, where each stop is written as [in, out]. The bus starts empty, and you need to return how many people are still on the bus after the final stop.

Примеры

Ввод
[[10, 0], [3, 5], [5, 8]]
Вывод
5
Ввод
[[3, 0], [9, 1], [4, 10], [12, 2], [6, 1], [7, 10]]
Вывод
17
Ввод
[[0, 0]]
Вывод
0

Нужно реализовать

def number(stops: list[list[int]]) -> int:

Теги

arraymath
PostgreSQLv16

Εδώ θα εμφανιστεί το αποτέλεσμα εκτέλεσης του κώδικα

Visible tests
1
Input
[[10,0],[3,5],[5,8]]
Expected5
2
Input
[[3,0],[9,1],[4,10],[12,2],[6,1],[7,10]]
Expected17
3
Input
[[0,0]]
Expected0
4
Input
[[5,0],[0,5]]
Expected0
5
Input
[[2,0],[2,1]]
Expected3
6
Input
[[10,0],[3,5],[5,8],[10,0]]
Expected15
Focus radio
Paused · SomaFM · Fluid