Roman to Integer: LeetCode Java Solution👋 Introduction Roman numerals were once the universal language of counting — from ancient Rome to modern programming puzzles. In this post, we’ll dive into LeetCode Problem #13: Roman to Integer, decode the logic, and implement a clean Java solution...Apr 6, 2025·3 min read
Boyer-Moore Voting Algorithm: Find the Majority Element Efficiently👋 Introduction One of the interesting questions asked in interviews is given an array of size n, find the majority element. The majority element is the one which appears more than n/2 times in the array. A brute-force way to solve this problem would...Feb 10, 2025·4 min read
Merge Sorted Array - LeetCode Java Solution👋 Introduction Welcome to my LeetCode Solutions in Java series! In each post, I’ll break down one LeetCode problem with a clear explanation, Java code, and a complexity analysis.Today, let's solve the problem Merge Sorted Array. This problem tests y...Feb 6, 2025·3 min read
Understanding 'computeIfAbsent' and 'computeIfPresent' in Java's HashMap👋 Introduction Java’s HashMap is one of the most commonly used data structures for storing key-value pairs. With the introduction of Java 8, several new methods were added to the Map interface to make operations more expressive and efficient — two s...Feb 1, 2025·3 min read
Remove Element - LeetCode Java Solution👋 Introduction Welcome to my LeetCode Solutions in Java series! In each post, I’ll break down one LeetCode problem with a clear explanation, Java code, and a complexity analysis.Today, we will solve the problem: Remove Element 🔍 Problem Statement ...Jan 28, 2025·2 min read
Remove Duplicates from Sorted Array - LeetCode Java Solution👋 Introduction Welcome to my LeetCode Solutions in Java series! In each post, I’ll break down one LeetCode problem with a clear explanation, Java code, and a complexity analysis.Today we will solve the problem: Remove Duplicates from Sorted Array. ...Jan 24, 2025·2 min read
Two Sum - LeetCode Java Solution👋 Introduction Welcome to my LeetCode Solutions in Java series! In each post, I’ll break down one LeetCode problem with a clear explanation, Java code, and a complexity analysis.Today’s problem: Two Sum — a classic and beginner-friendly challenge to...Jan 22, 2025·2 min read