LearnYard - Free Programming & DSA Blogs | Read, Code, Excel
  • C++ Course
  • DSA Course
  • Online Assessment DSA Questions
  • DSA for Frontend Interview
  • Frontend Interview Experience
  • Low Level Design
  • High Level Design
  • Java Course
  • About
  • Feedback
Sign in Subscribe

Prefix Sum

A collection of 28 posts

Minimum Penalty for a Shop

Problem Description You are given the customer visit log of a shop represented by a 0-indexed string customers consisting only of characters 'N' and 'Y': if the ith character is 'Y', it means that customers come at the ith hour whereas 'N'
07 Nov 2024 26 min read

Subarray Sum Equals K

Problem Description Given an array of integer nums and an integer k, return the total number of continuous subarrays whose sum equals k. Examples : Input: nums = [0, 1, 2, 3, 4, 5, 6], k=9 Output: 2 Explanation: There are 2 subarrays whose sum is 9 i.e. [2, 3,
27 Oct 2024 15 min read

Range Sum Query - Immutable

Problem Statement Given an integer array nums, handle multiple queries of the following type: Calculate the sum of the elements of nums between indices left and right inclusive where left <= right. Implement the NumArray class: NumArray(int[] nums) Initializes the object with the integer array nums. int sumRange(int
27 Oct 2024 13 min read
← Newer Posts Page 2 of 2
LearnYard - Free Programming & DSA Blogs | Read, Code, Excel © 2026
Powered by Ghost