Articles by Tag #prefixsum

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

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

Grid Game

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

Learn More 0 0Jan 23

Count (*) between pipes (|)

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

Learn More 0 0Jan 18

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

Maximum product subarray

Problem TC: O(n)O(n)O(n) SC: O(n)O(n)O(n) Using prefix and suffix array class...

Learn More 0 0Sep 30 '24

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

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

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