Subarray Sums I You are given an array of positive integers ‘ARR’ that represents the strengths of different “jutsus” (‘jutsu’ is a Japanese word for art i.e. ninja techniques) that a Ninja knows and can use to defeat enemies. You are also given the strength of the enemy ‘S’ (which is also a positive integer). Your tas...

read more
CodingNinjas
author
2y
Brute ForceA simple solution could be to traverse all the subarrays and calculate their sum. If the sum is equal to the given required sum, then, increment the count of subarrays. Finally return the c...
see more
CodingNinjas
author
2y
HashingAn efficient solution is while traversing the array, we keep storing the sum that we have gotten so far in ‘CURRSUM’. Here would also need to maintain the count of different values of ‘CURRSUM’...
see more
Help your peers!
Add answer anonymously...
SAP Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2023 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter