Given an array that contains alphabets and numbers, provide an algorithm to move the numbers to the front of the array and alphabets to the end of the array without changing their order in the given array.
Expected Space complexity: In place
Expected Time complexity: O(n)E.g:
Input: {1,2,a,3,b,c,4,d,5,e} Output: {1,2,3,4,5,a,b,c,d,e}
I came across this question in a website and couldn't figure out an algorithm that satisfies the space and time requirements. Can anyone please tell if it is possible to solve it inplace in O(n) time with the algorithm?