Is my logic wrong which case i am failing