Feb 10 · 4 min read · Prefix Sum It is a simple yet powerful technique that allows to perform fast calculation on the sum of elements in a given range (called contiguous segments of array) A Prefix Sum Array stores the cumulative sum of elements from the start up to the c...
Join discussion
Aug 19, 2025 · 14 min read · 🚀 Why This Matters Picture this: you're in a coding interview, and the interviewer asks, "Find the sum of elements between indices l and r for multiple queries." Your first instinct might be to loop through the range each time, but with large arrays...
Join discussionAug 1, 2025 · 1 min read · 🧠 Problem 🏷️ Tags array, greedy, prefix-sum 📊 Difficulty Medium ✅ Success Rate: 58.7%📥 Submissions: 2,054📈 Accepted: 1,206 ❤️ Reactions 👍 Likes: 30👎 Dislikes: 12 💡 Hints When should you use your armor ability? It is always optimal to use ...
Join discussionAug 1, 2025 · 1 min read · 🧠 Problem 🏷️ Tags array, prefix-sum 📊 Difficulty Medium ✅ Success Rate: 67%📥 Submissions: 1,031📈 Accepted: 691 ❤️ Reactions 👍 Likes: 21👎 Dislikes: 6 💡 Hints How can we use precalculation to efficiently calculate the average difference at ...
Join discussionJul 15, 2025 · 4 min read · In Codechef Round 194 Div 4, there was one particular question that completely shattered my confidence. After failing to solve it during the contest, my brain froze — and I couldn’t think clearly for the remaining problems. But after calming myself d...
Join discussionJul 4, 2025 · 5 min read · LeetCode Link Date: 2nd July 2025 Topics: String, Dynamic Programming, Prefix Sum Problem Understanding LeetCode 3333 builds upon the simpler "Find the Original Typed String I" problem by adding a crucial constraint: we need to find strings of lengt...
Join discussion
Feb 26, 2025 · 2 min read · Problem https://leetcode.com/problems/maximum-absolute-sum-of-any-subarray/description/ Leetcode - Maximum Absolute Sum of Any Subarray Type - Prefix Sum, Greedy Difficulty - Medium Approach & Solution Within the limit of prefix sum range [0, i], If ...
Join discussionFeb 25, 2025 · 2 min read · Problem https://leetcode.com/problems/number-of-sub-arrays-with-odd-sum/description/ Leetcode - Number of Sub-arrays With Odd Sum Type - Prefix Sum, Dynamic Programming Difficulty - Medium Approach && Solution Since the length of arr can be up to 10^...
Join discussion