It seems like that your code has some mistakes, if mid%=0, then right or left should be add 2, not 1? if just add 1, sometmes the left always smaller than right. as the following array{1,1,2,3,3,4,4,5,5}

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.