It's not so hard to type in the problem to a chatgpt on your second monitor or an iPad next to your screen and just retype the answer with some alterations
These are obviously extreme measures, but it is possible to try and enforce enhanced levels of proctoring. And I’m not saying I like the idea of doing this for all coding interviews, just that I guarantee people would go through with this if it meant a chance to get into big tech.
I guess if I wanted the job badly enough I’d spin up a vm for it.
You could ask it to write you bad code and refactor a few times. But, honestly, manually copying that code over and over again is probably educational gold.