Thank you!! The implementation is really quite wild and it became especially harsh when I realised “ambiguous” cases occurred – memoization really saved the day with the performance on this one at least haha