• + 0 comments

    How is it in O(1) Auxiliary space althoug you initialize array of n+1 long ints here

    long int *a=new long int[N+1]();
    

    you may use dictionary to shrink the used space.