+ 2

Sub Array With Given Sum

Hey !! I just created a code on the above question .. I run it through some test cases its working. .but I am not sure .if its exactly right or not ... So would anyone please help me figure out this one ? The Problem description is inside the code and every suggestion is Welcomed https://code.sololearn.com/cSOqHq87kxf1/?ref=app

7th Nov 2021, 2:44 AM
Vijay Gunwant
Vijay Gunwant - avatar
2 odpowiedzi
+ 1
Line 19: You forgot to put n on the statment. It should be this: cout << n << endl; Line 26: same thing but with sum. cout << sum << endl; Line 34: the same thing but with array. cout << array << endl; And Line 54: break is used with switch statements and not with the if statements. So you should remove it.
8th Nov 2021, 8:07 AM
Lebi
0
Lebi Actually those cout<<endl; are forcefully written by me to make my output look good instead of in one line and the break in line 54 is to break the loop when that condition is met ..
9th Nov 2021, 1:49 AM
Vijay Gunwant
Vijay Gunwant - avatar