Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.

book
Dorm Room Availability Check

Bill and Bob have recently joined the Codefinity University for Cool Engineers. They are now moving into a dormitory and want to share the same room. The dormitory has n rooms in total. Each room has a current occupancy and a maximum capacity. Your task is to determine how many rooms have enough space for both Bill and Bob to move in.

Given a list of n sublists, where each sublist contains two integers c (number of people currently living in the room) and m (room's maximum capacity), return the number of rooms where Bill and Bob can move in together.

Example 1

Input:

[[2, 2], [1, 10], [3, 5], [0, 2]]

Output:

3
main.cpp

main.cpp

C++

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

some-alt