You are viewing a single comment's thread. Return to all comments →
you have not used the k variable and also you have wrote a=a[last]; do not assign like this ..because you are using a in the loop afterwards.
Tip-->Assign the values in a using temporary variable.
since you are using 2 for loops and probably you need one while loop or nested for loop for this kind of approach ...so you may face timeout in some testcases.