Tagged articles

Prefix Sum

6 articles · Page 1 of 1
IT Services Circle
IT Services Circle
Sep 8, 2025 · Fundamentals

How to Count Subarrays with Sum K Using Prefix Sum and HashMap

This article first highlights Ctrip's employee benefits, then presents the LeetCode 560 subarray sum problem with detailed explanations and multi-language implementations using prefix sum and hash map, including Java, C++, Python, and TypeScript solutions, and discusses time and space complexities.

AlgorithmC++LeetCode
0 likes · 6 min read
How to Count Subarrays with Sum K Using Prefix Sum and HashMap
php Courses
php Courses
Apr 8, 2025 · Backend Development

Applying Prefix Sum Technique in PHP for Efficient Subarray Sum Queries

This article explains the concept of prefix sums, demonstrates how to build and use a prefix‑sum array in PHP with clear code examples, and discusses when the technique is advantageous and its limitations, enabling O(1) interval sum queries after an O(n) preprocessing step.

AlgorithmPHPPrefix Sum
0 likes · 10 min read
Applying Prefix Sum Technique in PHP for Efficient Subarray Sum Queries
YiSu Grain
YiSu Grain
Oct 23, 2024 · Fundamentals

Understanding Fenwick Tree: A Step‑by‑Step Guide

This article explains how a Fenwick (Binary Indexed) Tree stores prefix sums using binary representations and the least‑significant‑bit trick, shows concrete examples for computing sums of sub‑arrays, and provides a full Python implementation with update and query operations.

AlgorithmBinary Indexed TreeData Structure
0 likes · 9 min read
Understanding Fenwick Tree: A Step‑by‑Step Guide