I think they must mean "If you have a good sleep, you will be able to work out the answer." Your suggestion, "problem", is probably ok too, but I agree with you that "question" sounds really weird in that sentence.
I assume the speaker is talking to someone who has been working on a question for a long time but just can't find the answer. I agree with you that the sentence makes the speaker sound a bit over-confident that sleep is all that is needed. That doesn't make it grammatically wrong, but I would probably say "If you have/get a good sleep, you'll have a better chance of working out the answer in the morning" or something like "Why not stop now and sleep on it(*), it'll probably seem a lot clearer in the morning"
(*) to "sleep on (a problem)" is a common colloquial expression that means to go to sleep and allow your brain to process your thoughts overnight in the hope that things will be clearer in the morning instead of trying to solve it before you go to bed.