If it's a good question it doesn't matter if it's a puzzle that you found out of an interesting book you're trying to solve for fun, or something you need to solve in your day job at Some Corporation. It's just a programming question. You're more than welcome to mention that it's just a puzzle you're solving for fun if you want, you don't need to, but you certain can.
That has no basis on the quality of the question though. As with any question it should be clear what the problem you need to solve is (that shouldn't be so hard in your case) you should demonstrate research attempts and effort spent trying to solve the problem yourself. For a lot of these puzzles they're very common and have easily discoverable solutions online. Make sure to look for them before posting about it here. Next you should be posting your attempt at solving the problem. Ideally it would involve code, but it could be as simple as a higher level description of how you are approaching the problem. (If your "algorithm is wrong that may be what you question is about, rather than a more narrow "why doesn't this compile" type of question.) You should be describing what aspect of what you have so far isn't working. Are you getting errors, does it not compile, is the output wrong (if so, how is it wrong and what should it be), etc.
If you're just copy-pasting the puzzle onto the site and asking for a solution then it's a very low quality question (on any site) and is likely to be closed for a lack of research effort.
If you have put in this time and effort, and demonstrate that you have done so in your question, then it would be on topic on Stack Overflow