CSES- Maximum Subarray II | Why is this code giving correct answer?

Правка en6, от Rock2000, 2020-08-26 18:23:21

The first code is giving correct answer while second code is giving wrong answer. The only difference between these two codes is:
In the first code the return value is -2*inf in the getmax function while it is -inf in the second code. Can anybody please help me figure out what is the problem?
Link to Problem

Code 1
Code 2
Теги cses, maximum subarray sum

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en6 Английский Rock2000 2020-08-26 18:23:21 66
en5 Английский Rock2000 2020-08-26 18:10:30 10
en4 Английский Rock2000 2020-08-26 17:59:58 2 Tiny change: 'isThe first ' -> 'The first '
en3 Английский Rock2000 2020-08-26 17:59:08 3
en2 Английский Rock2000 2020-08-26 17:58:30 13 Tiny change: 'The first ' -> 'isThe first '
en1 Английский Rock2000 2020-08-26 17:57:55 4405 Initial revision (published)