Actually, I am trying to solve Collatz Conjecture To Figure Out Longest Collatz Sequence. Ifind the longest Collatz Sequence:
Which starting number, ≤ N, produces the longest chain? If many possible such numbers are there print the maximum one. (1 ≤ N ≤ 5×106)
I tried optimizing the code to include memoization still getting TLETime Limit Exceeded, for this solutionthese solutions. Wanted some help to understand where the method is consuming time.