---
# System prepended metadata

title: Prefix Sum Study Guide
tags: [資料結構和演算法]

---

Prefix Sum Study Guide
======================

:::warning
[< Return to Home Page](https://hackmd.io/@siansiansu/HknJJm0W0)
:::

Basic Prefix Sum
----------------

Fundamental problems that introduce the concept and basic usage of prefix sums.

-   🟨 [238\. Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/) \[[Solution](https://hackmd.io/@siansiansu/BJQpukKVC)\]
-   🟨 [560\. Subarray Sum Equals K](https://leetcode.com/problems/subarray-sum-equals-k/) \[Solution\]

Advanced Prefix Sum Techniques
------------------------------

More complex applications of prefix sums, often combined with other concepts.

### Prefix Sum with Modular Arithmetic

Problems that combine prefix sums with modular arithmetic for efficient calculations.

-   🟨 [523\. Continuous Subarray Sum](https://leetcode.com/problems/continuous-subarray-sum/) \[[Solution](https://hackmd.io/@siansiansu/rkYmXBZS0)\]

### Prefix Sum with HashMap

Problems that use hashmaps in conjunction with prefix sums for optimized solutions.

-   🟨 [974\. Subarray Sums Divisible by K](https://leetcode.com/problems/subarray-sums-divisible-by-k/) \[[Solution](https://hackmd.io/@siansiansu/rJmZLTzBA)\]

Problem Difficulty Legend
-------------------------

-   🟩 Easy
-   🟨 Medium
-   🟧 Medium-Hard
-   🟥 Hard
-   ⬛ Very Hard

Additional Resources
--------------------

-   [Prefix Sum Array – Implementation and Applications](https://www.geeksforgeeks.org/prefix-sum-array-implementation-applications-competitive-programming/)
-   [Range Sum Query - Immutable (LeetCode)](https://leetcode.com/problems/range-sum-query-immutable/)
-   [Prefix Sums Technique (Competitive Programming Algorithms)](https://cp-algorithms.com/data_structures/prefix_sum.html)
