반응형
Your car is old, it breaks easily. The shock absorbers are gone and you think it can handle about 15 more bumps before it dies totally.
Unfortunately for you, your drive is very bumpy! Given a string showing either flat road (_) or bumps (n). If you are able to reach home safely by encountering 15 bumps or less, return Woohoo!, otherwise return Car Dead
Solution:
def bumps(road):
return road.count("n") > 15 and "Car Dead" or "Woohoo!"
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
1212. String cleaning (0) | 2022.12.12 |
---|---|
1211. Maximum Product (0) | 2022.12.11 |
1209. Grasshopper - Combine strings (0) | 2022.12.09 |
1208. A Strange Trip to the Market (0) | 2022.12.08 |
1207. Vowel Count (0) | 2022.12.07 |