TapeEquilibrium  problem solved.

Space complexity O(n)
Temp complexity O(n)  T(n*3)

I think I could remove one loop