https://ide.codingblocks.com/s/330782 LOGIC:i have maitained variables cnta,cntb,difference. and use cnta and cntb to compare wether to change a or b.
Why are all the test cases failing
Your logic is incorrect , you need to use a different approach. If you want I can share it.