Yahoo India Web Search

Search results

  1. Subarray Sum Equals K - Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k. A subarray is a contiguous non-empty sequence of elements within an array.

  2. Mar 31, 2023 · Given an unsorted array of integers, find the number of subarrays having a sum exactly equal to a given number k. Examples: Input : arr [] = {10, 2, -2, -20, 10}, k = -10. Output : 3. Explanation: Subarrays: arr [0…3], arr [1…4], arr [3..4] have a sum exactly equal to -10. Input : arr [] = {9, 4, 20, 3, 10, 5}, k = 33. Output : 2.

  3. Given an unsorted array of integers, find the number of continuous subarrays having sum exactly equal to a given number k. Example 1: Input: N = 5. Arr = {10 , 2, -2, -20, 10} k = -10. Output: 3. Explaination: . Subarrays: arr[0...3], arr[1...4], arr.

  4. Apr 13, 2024 · Count of Subarrays with sum equals k in given Binary Array - GeeksforGeeks. Last Updated : 13 Apr, 2024. Given a binary array arr [] and an integer k, the task is to find the count of non-empty subarrays with a sum equal to k. Examples: Input: arr [] = {1, 0, 1, 1, 0, 1}, k = 2. Output: 6.

  5. Nov 12, 2021 · Problem Statement. Given an array a [], find the number of subarrays in it, which have a sum of k. Subarray: A subarray of an array is formed by deleting some (possibly zero) elements from the beginning or end of the array. The red region shows a subarray of the original array.

  6. Mar 18, 2024 · The main idea in this approach is to check for each possible subarray if its sum is equal to , or not. Initially, we’ll go through every possible start of a subarray. Then, we’ll fix it for each start and try all the possible ends.

  7. 560. Subarray Sum Equals K. Medium Array Hash Table Prefix Sum. Leetcode Link. Problem Description. The problem at hand involves finding the total number of contiguous subarrays within a given array of integers ( nums) that add up to a specified integer ( k ).

  1. People also search for