Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Feel free to explore, learn, and share your own approaches.
- [x] **3/20:** Cherry Blossoms 🌸
- [x] **3/21:** First Tweet 🐦
- [x] **3/22:** Water Day 💧
- [x] **3/23:** Cuddly Kittens 🐈
- [x] **3/23:** [Cuddly Kittens](https://github.com/codedex-io/daily-challenges/tree/main/march-2026/3-23-cuddly-kittens) 🐈
- [ ] **3/24:** ❓❓❓
- [ ] **3/25:** ❓❓❓
- [ ] **3/26:** ❓❓❓
Expand Down
19 changes: 19 additions & 0 deletions march-2026/3-23-cuddly-kittens/cuddly-kittens.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
def cuddly_kittens(kittens, limit):
# init a variable longest
longest = 0

# for each cat
for i in range(len(kittens)):
# for each cat on the right
for j in range(i, len(kittens)):
# we define a group of
# current kitten + the one on the right
group = kittens[i:j+1]

# we check if group is calm
if max(group) - min(group) <= limit:
longest = max(longest, j - i + 1)
else:
break

return longest