11 Jun
2018
11 Jun
'18
10:18 p.m.
It's not a bug. Since 0 is falsy value, `0 or 2` is 2, not 0. You need to use `prev if prev < curr else curr` instead of `cond and A or B` hack.