here is the code https://ide.codingblocks.com/s/225713
pls help
Why it is showing segmentation fault
hello @pyash
you are applying greedy algorithm,it will not work on this problem becuase both the player are playing optimally.
refer this ->

thanks alot for the approach