+ 3
Challenge : find [sub-array]
Given an unsorted array of positive integers, find a continuous sub-array which adds to a given number. Description: take size of array from user, say n, now input n elements in array, take a number i.e sum, Now find a sub array and show their position which adds to the given sum. Example 1: Input: Size of array: 5 Array Elements: 1 2 3 7 5 Sum: 12 Output: Position 2 to 4 is 12 Example 2: Input: Size of array: 10 Array Elements: 1 2 3 4 5 6 7 8 9 10 Sum: 15 Output: Position 1 to 5 is 15
3 Answers
+ 13
Here's my C# implementation! ā
I noticed there are no C# tag but I still submit anyway as one can easily convert it into any languages since the algorithm is pretty striaghtforward. Enjoy~ ā¤
P/S: You may label your post with "challenge" or "challenges" tag to attract more submissions. š
https://code.sololearn.com/cJ0JrXN4sYtQ/?ref=app
+ 4
Note: There might be more than 1 sub arrays, but only first occurrence should be found.
+ 2
I have something like this check this code:
https://code.sololearn.com/crGHXawXbrRe/?ref=app