Not getting correct output

please check i am not getting correct output and tell where is the mistake in my logic

@shivamgoel150 you were taking input t which was not required, also your code had issues with indexing and incorrect swapping.