I think I almost got it! But the interview was an extremely complex coding challenge especially given the constrained time frame allotted for its completion.
I remember needed to close with the return line, but time was up.
Although I didn't get an offer I am quite proud of my performance. Also I am VERY thankful for the opportunity of interviewing.
After I interacted with the interviewer, it's just intuition, I sensed that this project/team wasn't necessarily for me, I am not sure why.
If you don't have at least around 10 years of experience coding in Python, along with a strong understanding of math, data structures, and algorithms, I think it will be nearly impossible to navigate through that level of complexity in 40 minutes.