One test case not passing

I wanted to do this questions by not using bitwise can you tell why my code is not passing one test case , also is there a way to store frequencies using one loop?

If you have sorted the array then compare the neighbours in the array only no need of two loops .
the element which do not have equal neighbours will be the unique element .
Hope it helps :blush: . Mark the doubt as resolved if it is resolved