menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Given an a...
source image

Prodevelopertutorial

1w

read

343

img
dot

Given an array and a key element, find the number of continuous elements whose sum is greater than the key element.

  • Given an array and a key element, find the number of continuous elements whose sum is greater than the key element.
  • Solution: Use the two pointers with sliding window approach to solve the problem.
  • Increase the right pointer until the sum is greater than or equal to the key element.
  • Then increase the left pointer to the right pointer until the sum is less than the key element. Store the minimum length in a variable.

Read Full Article

like

20 Likes

For uninterrupted reading, download the app