Day 21 - Merge, Detect, and Contribute

Revisiting Merge Intervals, Floyd’s Algorithm, and Kafka Open Source
Author

Shashank Hosahalli Shivamurthy

Published

July 9, 2025

Day 21 - Merge, Detect, and Contribute

Started off the day by re-solving 56. Merge Intervals again.

Now I know it inside out. Felt good to reinforce it.


Leetcode Practice

88. Merge Sorted Array

  • Brute force: Just iterate both arrays and merge into a new array, then copy back
  • Not optimal due to extra space
  • Optimal: Start from the end, compare last indices, and fill from the back of the original array
  • This avoids using extra space

287. Find the Duplicate Number

  • Brute force: Use a set or count array to track frequencies

  • As soon as frequency goes above 1 → return the element

  • Optimal: Floyd’s Tortoise and Hare (Cycle Detection)

    • Use slow and fast pointers
    • Slow moves 1 step, Fast moves 2
    • They’ll collide at some point inside the loop
    • Then reset one to start and move both by 1 step → collision point is the duplicate
    • All done in constant space

Kafka Contribution Work

Started diving into contributing to Apache Kafka’s open source.

Found a couple of issues that looked simple…
but definitely weren’t as simple as I initially thought 😅

Spent the entire rest of the day on this.

But something new, I guess. It’s fascinating to see the community support.

🧠 Kafka Day 3 Notes


All in all - good problem solving + open source learning.
Let’s keep going.