Not passing all testcases

the question is providing the integer array but you are trying to solve using string.
Code