Just FYI these two are not equivalent. Yours will return 0 if the data consists of [1, -1] whereas mine will return 1.
4 Likes
Just FYI these two are not equivalent. Yours will return 0 if the data consists of [1, -1] whereas mine will return 1.