Gtting TLE on Hackerrank

While submitting on hackerrank I am getting TLE.

HackerEarth*…

approach is fine, just try to make few changes such that your dont computes s1.length and s2.length again and again .
if it wont work try to submit in c++;

still getting TLE after replacing length attribute


check my sol then