Back to Browse

DAY19 Leetcode | I Learned a New HashMap Trick Solving This πŸ˜„ (LeetCode 3740)

12 views
Apr 10, 2026
21:54

In this video, I worked on LeetCode 3740 (Minimum Distance Between Three Equal Elements I), an easy problem focused on finding patterns in arrays. While solving this problem, I used a HashMap to store indices of each value and explored a new method: computeIfAbsent. This helped simplify the process of grouping indices and made the implementation cleaner. This was a good exercise in improving my understanding of HashMaps and writing cleaner Java code. πŸš€ Problem: Minimum Distance Between Three Equal Elements I πŸ’‘ Focus: HashMap + grouping indices Let me know if you’ve used computeIfAbsent before or if this is new to you! #leetcode #java #hashmap #coding #dsa #learning

Download

0 formats

No download links available.

DAY19 Leetcode | I Learned a New HashMap Trick Solving This πŸ˜„ (LeetCode 3740) | NatokHD