Articles by Tag #prefixsum

Browse our collection of articles on various topics related to IT technologies. Dive in and explore something new!

No of ways to split Array

Problem TC: O(n) for calculating prefix sum, and O(n) for iterating over the prefix sum for...

Learn More 0 0Jan 3

Sum of variable length subarray

Problem TC: O(n) SC:O(n) class Solution { public int subarraySum(int[] nums) { int...

Learn More 0 0Jan 20

⏱️ O(N) to O(1): How Prefix Sum Will Change Your Code Forever

🚀 Mastering Prefix Sum in C++: From Naive to Optimized The Prefix Sum technique is one of...

Learn More 0 0Jul 29

Unfolding: LeetCode 560. Subarray Sum Equals K

A disguised medium difficulty problem in LeetCode. We must honor this as a hard one... :) Source...

Learn More 0 0May 22

Grid Game

Problem TC: O(n) SC: O(n) class Solution { public long gridGame(int[][] grid) { long...

Learn More 0 0Jan 23

Range Sum Query - Immutable

Problem TC: O(n) for calculating the prefix sum and O(1) for getting the sum of the subarray in the...

Learn More 0 0Jan 2

Count vowel strings in ranges

Problem TC: O(n) for calculating the prefix[] and O(k) for getting all the counts of the vowels in...

Learn More 0 0Jan 2

Count (*) between pipes (|)

Problem Statement: Count Stars Between Pipes Problem Description You are given...

Learn More 0 1Jan 18