Files
freecodecamp--freecodecamp/curriculum/challenges/english/blocks/daily-coding-challenges-python/69f35a5bb823ed620fcb7cbe.md
T
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

94 lines
2.7 KiB
Markdown

---
id: 69f35a5bb823ed620fcb7cbe
title: "Challenge 285: Meeting Time"
challengeType: 29
dashedName: challenge-285
---
# --description--
Given a 3D array representing availability windows for multiple people, return the earliest time where everyone has one hour free. If no such time exists, return `"None"`.
- Each person's availability is an array of `[start, end]` integer pairs in 24-hour time. For example, `[10, 12]` would mean the person is available from 10 to 12. Start times range from 0-23, and end times range from 1-24.
For example, given:
```json
[
[[10, 12], [15, 16]], // person 1
[[11, 14], [15, 16]] // person 2
]
```
Return `11`, the start of their first shared free hour.
# --hints--
`get_meeting_time([[[10, 12], [15, 16]], [[11, 14], [15, 16]]])` should return `11`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_meeting_time([[[10, 12], [15, 16]], [[11, 14], [15, 16]]]), 11)`)
}})
```
`get_meeting_time([[[9, 10], [12, 15]], [[10, 11], [13, 14]], [[9, 11], [10, 14]]])` should return `13`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_meeting_time([[[9, 10], [12, 15]], [[10, 11], [13, 14]], [[9, 11], [10, 14]]]), 13)`)
}})
```
`get_meeting_time([[[7, 8], [9, 11], [12, 14], [15, 16]], [[8, 11], [12, 13], [14, 15]]])` should return `9`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_meeting_time([[[7, 8], [9, 11], [12, 14], [15, 16]], [[8, 11], [12, 13], [14, 15]]]), 9)`)
}})
```
`get_meeting_time([[[7, 8], [10, 12], [13, 15]], [[8, 11], [12, 13], [14, 15]], [[6, 7], [8, 9], [12, 13]]])` should return `None`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_meeting_time([[[7, 8], [10, 12], [13, 15]], [[8, 11], [12, 13], [14, 15]], [[6, 7], [8, 9], [12, 13]]]), "None")`)
}})
```
`get_meeting_time([[[1, 3], [4, 6], [8, 10], [20, 23]], [[15, 16], [17, 18], [19, 22], [23, 24]], [[14, 16], [17, 23]], [[2, 4], [5, 6], [18, 19], [21, 22], [23, 24]]])` should return `21`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_meeting_time([[[1, 3], [4, 6], [8, 10], [20, 23]], [[15, 16], [17, 18], [19, 22], [23, 24]], [[14, 16], [17, 23]], [[2, 4], [5, 6], [18, 19], [21, 22], [23, 24]]]), 21)`)
}})
```
# --seed--
## --seed-contents--
```py
def get_meeting_time(availability):
return availability
```
# --solutions--
```py
def get_meeting_time(availability):
for hour in range(24):
if all(
any(start <= hour and hour + 1 <= end for start, end in person)
for person in availability
):
return hour
return "None"
```