100 Days of Consistency and Growth in LeetCode

Day 100: Consistency, Growth, and a Milestone 💯 Problem 3740: Minimum Distance Between Three Equal Elements I Today marks 100 days of continuous problem-solving. While the number is just a marker, the real value has been the daily discipline of opening the IDE and tackling whatever challenge LeetCode throws my way. The Strategy: • Frequency Grouping: I used a HashMap to store a list of indices for every unique number in the array. This allowed me to isolate potential triplets instantly. • Sliding Window Logic: For any number appearing three or more times, I looked at a sliding window of three consecutive indices (i,i+1,i+2). • The Formula: Through testing, I identified that the minimum distance between three equal elements can be derived from the span between the first and third occurrence: (index of 3rd - index of 1st) * 2. • Optimization: By iterating through the pre-grouped index lists, I kept the solution efficient and clean. Reflecting on these 100 days, I’ve moved from basic simulations to complex optimizations like Square Root Decomposition and 3D DP. The goal isn't to stop here—it's to keep building, keep optimizing, and keep growing. 🚀 #LeetCode #Java #Algorithms #DataStructures #100DaysOfCode #Consistency #ProblemSolving #DailyCode

  • text

To view or add a comment, sign in

Explore content categories