Even though the problem is very simple, but the AI solving it and explaining it so well is scary. AI coding is definitely going to reduce the number of programmers required in the coming years. This looks dangerous enough to completely replace an intern even now.
An intern I don't expect to contribute anything of value by definition, but if even a junior human programmer gave me anything involving O(n) memory to solve either of these problems they'd be getting some serious performance review notes.
If this is the future of programming I hope you love systems that suck.