Search:

Type: Posts; User: dicdic

Search: Search took 0.20 seconds.

  1. Replies
    11
    Views
    1,262

    Re: MaxSum algorithm with negative values in Array

    I'm still a little bit confused on what your method maxSum is really doing. can you explain what does that method can do?
    and please explain what each statement doing. you can put a comment. because...
  2. Replies
    11
    Views
    1,262

    Re: MaxSum algorithm with negative values in Array

    why you cannot change that? Actually that is the reason why you got a wrong sum. And there is also one nonsense statement i=j+1;, that statement is completely nonsense. you just equated i to j + 1...
  3. Replies
    11
    Views
    1,262

    Re: MaxSum algorithm with negative values in Array

    that is because of your conditional statement in public static int maxSum(int [] a) try to remove them and just put a max_sum += the array element. that should do it
  4. Replies
    11
    Views
    1,262

    Re: MaxSum algorithm with negative values in Array

    7 in your code? how come that it should be 7? I'm sorry, I'm a little bit confused on your requirements
  5. Replies
    11
    Views
    1,262

    Re: MaxSum algorithm with negative values in Array

    so if I input 1,2,3,-4,5,-6 the result is 1? is it right?
  6. Replies
    11
    Views
    1,262

    Re: MaxSum algorithm with negative values in Array

    lets talk about your method public static int maxSum(int [] a)
    can you explain what is that doing? a comment maybe.

    As what I understand with your problem, you want to get the sum of your integer...
Results 1 to 6 of 6