kadane algorithm
public int kadane(int[] arr){ int max_so_far = 0, curr_max = Integer.MIN_VALUE; for(int i: arr){ max_so_far += i; if(max_so_far<0) max_so_far = 0; if(max_so_far>curr_max) curr_max = max_so_far; } return curr_max; }
kadane algorithm
public int kadane(int[] arr){ int max_so_far = 0, curr_max = Integer.MIN_VALUE; for(int i: arr){ max_so_far += i; if(max_so_far<0) max_so_far = 0; if(max_so_far>curr_max) curr_max = max_so_far; } return curr_max; }
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us