×
Home Discussions Write at Opengenus IQ
×
  • DSA Cheatsheet
  • HOME
  • Track your progress
  • Deep Learning (FREE)
  • Join our Internship 🎓
  • RANDOM
  • One Liner

prefix sum array

A collection of 8 posts

Algorithms

Largest sub-array with equal number of 1 and 0

In this article, we have explored 3 different approaches to find the Largest sub-array with equal number of 1 and 0. This involve the concept of Hash Map/ Set and Prefix Sum.

Bhavani Sankar Nagarapu Bhavani Sankar Nagarapu
prefix sum array

Corporate Flight Bookings problem [Solved]

In this article, we will solve Corporate Flight Bookings problem using prefix sum algorithm. In naïve approach, it will take a quadratic O(N^2) time complexity but using a prefix sum approach we can get better time complexity.

Abrham Lakew Abrham Lakew
Interview Problems on Array

Car Pooling Problem

In this article, we have explored the Car Pooling Problem in depth and presented an efficient approach to solve it using the concept of Prefix Sum.

Anuj Dharme
Algorithms

Number of Substrings in String of 0s and 1s that have K 1s

In this article, we have explored algorithm to find the Number of Substrings in a String of 0's and 1's that have 'K' number of 1's.

Deepak Tiwari
Data Structures

Data Structure with insert and product of last K elements operations

We have presented 2 designs for Data Structure with insert and product of last K elements operations. Both operations can be done in constant time O(1).

Vikram Shishupalsingh Bais Vikram Shishupalsingh Bais
List of Mathematical Algorithms

Equilibrium Index: Find index such that sum of left sub-array = right sub-array

For a given array, we need to find an index such that sum of left sub-array = right sub-array also called the Equilibrium Index. We solve this using brute force approach O(N^2) and using prefix array in linear O(N) time.

Shreya Shah Shreya Shah
Algorithms

Tile Stacking Problem

We demonstrate how we will reduce the time complexity from O((k+1)^(m+1)) to O(N * M * K) to O(N * M). We have infinite number of tiles of sizes 1 to m. The task is calculate the number of different stable tower of height n with restriction that you can use at most k tiles of each size in the tower

Sadanand Vishwas Sadanand Vishwas
Data Structures

Prefix sum array

Prefix Sum array is a data structure design which helps us to answer several queries such as sum in a given range in constant time which would otherwise take linear time. It requires a linear time preprocessing and is widely used due to its simplicity and effectiveness.

Yash Aggarwal Yash Aggarwal
OpenGenus IQ © 2025 All rights reserved â„¢
Contact - Email: team@opengenus.org
Primary Address: JR Shinjuku Miraina Tower, Tokyo, Shinjuku 160-0022, JP
Office #2: Commercial Complex D4, Delhi, Delhi 110017, IN
Top Posts LinkedIn Twitter
Android App
Apply for Internship