I was surprised reading through this problem that the machine solved it well at all.
I get that it’s a leet code style question but it’s got a lot of specifics and I assumed the corpus of training data on optimizing this type of problem was several orders of magnitude too small to train an LLM on and have good results.
Something like that.
As someone with a degree in computer science it reminds me of almost every course I took. As someone who has worked at multiple FAANG and adjacent companies with high expectations, I’ve encountered things like this in most interviews and have devised similar problems to be given as interviews. The point isn’t to make something objectively useful in the question itself but to provide a toy example of a specific class of problem that absolutely shows up in practical situations, although by in large most IT programmers would never see such a problem in their careers. This does not however mean such problems don’t exist in the world and are not solved by computer scientists professionally at work in practical uses. Beyond that they also are tests of how well people have learned computer science, discrete math, and complex programming as a proxy for general technical intelligence (albeit not testing any specific technology or toolkit, as is emphasized in IT work). This seems surprising to me when people belly ache about computer science being asked in any context - at school, work, or in a programming contest as if the only worthwhile things to do are systems programming questions.