paint-brush
Prefix Sums and How They Can be Used to Solve Coding Problemsby@micogongob
1,744 reads
1,744 reads

Prefix Sums and How They Can be Used to Solve Coding Problems

by Mico Gongob3mNovember 8th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Prefix sums is a simple yet powerful technique that we can use to easily calculate the sum of a segment or an array. It allows us to use a reusable lookup array to look up the sum for the whole array in constant time. The first approach would have been how many times we need to recalculate different array segments. With prefix sums, our time is reduced to O(O(n + m) times we can get the sum in constant O(1) time. In this post, we will look at prefix sums and how they can be used to solve a common coding problem.

Company Mentioned

Mention Thumbnail
featured image - Prefix Sums and How They Can be Used to Solve Coding Problems
Mico Gongob HackerNoon profile picture
Mico Gongob

Mico Gongob

@micogongob

Software Engineer from the Philippines

About @micogongob
LEARN MORE ABOUT @MICOGONGOB'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Mico Gongob HackerNoon profile picture
Mico Gongob@micogongob
Software Engineer from the Philippines

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Also published here
Newsbreak
Websiteperu
Coffee-web
Prodsens
Owlver
Owlver
Style-tricks
Cyberfishnews