Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(int i = 0; i < n-k+1; i++){
- int current_sum = 0;
- for(int j = 0; j < k; j++){
- current_sum = current_sum + arr[i+j];
- }
- max_sum = max(current_sum, max_sum); // pick maximum sum
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement