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...
Top SAP Software Developer Intern interview questions & answers
Popular interview questions of Software Developer Intern
Stay ahead in your career. Get AmbitionBox app
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