Ashish kindly make an option to hover over previous or next questions. It is very hectic to go back and find the question again. Log in to Reply
PrepInsta Support Sure, We would pass on this feedback to the dev team and make it out priority 🙂 Log in to Reply
Shrutika #include #include using namespace std; int fun(int arr1[],int size, int k1){ if(k1size){ return 0; } vector minsum; for(int i=0;i<=size-k1;i++){ int sum=0; for(int j=i; j<i+k1; j++){ cout<<arr1[j]<<" "; sum+=arr1[j]; } minsum.push_back(sum); cout<<endl; } sort(minsum.begin(), minsum.end()); return minsum[0]; } int main(){ int n=7; int k=3; int arr[n]={3, 2, 1, -4, 6, 3, 1}; cout<<fun(arr,n,k); return 0; } Log in to Reply
PrepInsta Support Hey, Join our TA Support Group on Discord, where we will help you out with all your technical queries: 📍Discord Log in to Reply
kindly make an option to hover over previous or next questions. It is very hectic to go back and find the question again.
Sure, We would pass on this feedback to the dev team and make it out priority 🙂
#include
#include
using namespace std;
int fun(int arr1[],int size, int k1){
if(k1size){
return 0;
}
vector minsum;
for(int i=0;i<=size-k1;i++){
int sum=0;
for(int j=i; j<i+k1; j++){
cout<<arr1[j]<<" ";
sum+=arr1[j];
}
minsum.push_back(sum);
cout<<endl;
}
sort(minsum.begin(), minsum.end());
return minsum[0];
}
int main(){
int n=7;
int k=3;
int arr[n]={3, 2, 1, -4, 6, 3, 1};
cout<<fun(arr,n,k);
return 0;
}
Hey, Join our TA Support Group on Discord, where we will help you out with all your technical queries:
📍Discord