Advertisement
Guest User

Untitled

a guest
Feb 12th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. for(int i = 0; i < n-k+1; i++){
  2. int current_sum = 0;
  3.  
  4. for(int j = 0; j < k; j++){
  5. current_sum = current_sum + arr[i+j];
  6. }
  7. max_sum = max(current_sum, max_sum); // pick maximum sum
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement