From 25b542a052028088e3c062641f782744ef381d57 Mon Sep 17 00:00:00 2001 From: Alan Geirnaert Date: Tue, 24 Mar 2026 11:06:22 +0100 Subject: [PATCH 1/2] chore: updates README file with today's link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0aaa714..396621c 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Feel free to explore, learn, and share your own approaches. - [x] **3/21:** First Tweet 🐦 - [x] **3/22:** Water Day 💧 - [x] **3/23:** Cuddly Kittens 🐈 -- [ ] **3/24:** Earthquake Anomaly 🌏 +- [x] **3/24:** [Earthquake Anomaly](https://github.com/codedex-io/daily-challenges/tree/main/march-2026/3-24-earthquake-anomaly) 🌏 - [ ] **3/25:** ❓❓❓ - [ ] **3/26:** ❓❓❓ - [ ] **3/26:** ❓❓❓ From 4afaddf777a1850815016e7950b2bfd48eee72d4 Mon Sep 17 00:00:00 2001 From: Alan Geirnaert Date: Tue, 24 Mar 2026 11:06:32 +0100 Subject: [PATCH 2/2] feat: earthquake anomaly python solution --- .../earthquake-anomaly.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 march-2026/3-24-earthquake-anomaly/earthquake-anomaly.py diff --git a/march-2026/3-24-earthquake-anomaly/earthquake-anomaly.py b/march-2026/3-24-earthquake-anomaly/earthquake-anomaly.py new file mode 100644 index 0000000..db5f6c2 --- /dev/null +++ b/march-2026/3-24-earthquake-anomaly/earthquake-anomaly.py @@ -0,0 +1,19 @@ +def earthquake_anomaly(readings): + # if no readings we simply return an empty array + if not readings: + return [] + + # first we sort the readings + sorted_readings = sorted(readings) + n = len(sorted_readings) + + # find the median + if n % 2 == 1: + median = sorted_readings[n // 2] + else: + median = (sorted_readings[n // 2 - 1] + sorted_readings[n // 2]) / 2 + + # now let's find the threshold + threshold = median * 1.5 + + return [i for i, thresh in enumerate(readings) if thresh > threshold] \ No newline at end of file