diff --git a/README.md b/README.md index 7e12976..f00b353 100644 --- a/README.md +++ b/README.md @@ -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:** ❓❓❓ diff --git a/march-2026/3-23-cuddly-kittens/cuddly-kittens.py b/march-2026/3-23-cuddly-kittens/cuddly-kittens.py new file mode 100644 index 0000000..fbb2859 --- /dev/null +++ b/march-2026/3-23-cuddly-kittens/cuddly-kittens.py @@ -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 \ No newline at end of file