where did TLE come from in this code?
Check your j loop in the bubble sort. The j<=n-i-1 should be used.