Timeout
ABC 408Problem 8 of 50
EasyWhat to do
An elder starts awake at time 0 and is tapped at times given in `taps`. The elder falls asleep if more than `s` seconds pass between consecutive taps (or from time 0 to the first tap). Return 'Yes' if the elder stays awake through all taps, 'No' if they ever fall asleep.
Key Concepts
if-statements
loops
basic math
input/output
Examples
Input:
n = 5, s = 10, taps = [6, 11, 21, 22, 30]
Output:
Yes
Input:
n = 2, s = 100, taps = [1, 200]
Output:
No
Tips for Beginners
- Focus on understanding the logic, not memorizing syntax
- Use print statements to debug your code
- Don't worry about input parsing - the function handles that for you
- If stuck, try writing out your solution on paper first
Python Editor
Loading Python...