I've seen people solve this by telling chatGPT explicitly to break down this problem in different steps and then it solves it. It's like you are putting someone on the spot as opposed to giving him time to think about it.