You can, and you should, so that reviewers can better understand and contextualize your code.
But that doesn't always mean that you should copy & paste the problem statement verbatim.
I imagine that each book has trademarks and/or copyrights along with licensingAll content (unless explicitly declared to be in the public domain) is protected by copyright law, asand as long as you follow those,the license terms available for that copyright content then you should be able to post with the proper citation, just like if you were writing a research paper you would be bound by MLA or APA rules for Citationproblem statement here.
Anything posted on Stack Exchange sites is posted under CC By-SA 3.0 with Attribution Required. This may, or may not be compatible with the licenses available to the source's problem statement.
Most of the time if you citeIf there is any doubt, it is best to restate the work properlyproblem in your own words, youbut still link to the source so that others can post it whereverseek more information there, and also as attribution.
When stating things in your own words, you like while followingshould still follow the advice you were given on your Law Post
- is what was taken an insignificant amount of the entire work?
- is reference made to the original work?
- is your work transformative, changing the original into something new?
- is your purpose non-commercial, that is, not one aimed at deriving directly related economic benefits?
If you can safely answer "yes" to all of the above, you're safe.
Bottom Line:
YouWhen in doubt you should describe the problem in your own words and link back to the problem as both attribution, and so others can find the source.
or (at your own risk)
Make sure to cite your source appropriately according to the source's Copyright/Trademark/Licensing.
If your post violates the Author's/Publisher's rights under any Trademark/Copyright/License/Terms and Conditions, it will beCopyright then they may request that the content is removed by following the StackExchange copyright take-down process as legislated by the DMCA. See Stack Exchange's Legal pages.