Mar 12, 2025 · 4 min read · Finding subarrays with a specific sum is a classic problem in computer science. In this blog post, we'll explore an efficient solution using the concept of prefix sums and a HashMap in Java. Understanding the Problem Given an array of integers num an...
Join discussionJul 15, 2024 · 3 min read · Introduction Today, I tackled another intriguing problem from LeetCode 75: Find Pivot Index. This easy-level question requires an understanding of prefix sums and arrays. The goal is to find the pivot index where the sum of the numbers to the left of...
Join discussionSep 6, 2023 · 15 min read · Infix Notation Infix is the day-to-day notation that we use of format A + B type. The general form can be classified as (a op b) where a and b are operands(variables) and op is the Operator. Example 1 : A + B Example 2 : A * B + C / D Postfix Not...
Join discussion
Aug 29, 2023 · 6 min read · If you've started to venture into the world of programming, you might have come across situations where you need to work with parts of a list, even though you might not realize it just yet. No worries if this sounds new – I'm here to walk you through...
Join discussionMay 30, 2023 · 3 min read · There are countless ways to approach this problem and optimize your solution. In this article, we’ll explore one of those strategies to tackle this problem. Let’s see the problem statement first. Problem Statement: Given an array of integers nums, c...
Join discussion
May 1, 2023 · 6 min read · 📍Introduction A Prefix array is a simple yet effective tool in computer programming. It helps to minimize the repeated calculations done in an array and reduces the time complexity of your program. 📍What is a Prefix Array? A Prefix Sum Array is a c...
YYounus commented
Jun 18, 2022 · 1 min read · Question Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]). Return the running sum of nums. Example 1: Input: nums = [1,2,3,4] Output: [1,3,6,10] Explanation: Running sum is obtained as follows: [1, 1+2,...
Join discussionJun 18, 2022 · 2 min read · Question: Given an array of integers nums, calculate the pivot index of this array. The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly to the index's right. ...
Join discussion