Optimal game strategy

ques
https://online.codingblocks.com/app/player/97658/content/98716/4939/code-challenge

test case 2 isn’t passing