A few weeks ago I was approached by a reader, Mark, asking for algorithm advice. He had a simple, well-bounded, easily-verifiable problem: sort an array based on a certain combination of the values’ digits. This question was both interesting and easy enough for me, which made me think that this would be an excellent problem for Cody.
Using Cody to solve a problem like this has numerous advantages. First off, you’ll get an answer quicker and more complete than you would by asking me to help you out. Second, it will only cost your time. Third, it helps out the Cody community by keeping the pipeline full of interesting challenges.
Creating a new problem is simple and fun:
- From Cody, press the big blue “Create a Problem” button.
- Fill out the problem title and description. If you can formulate the problem clearly in a few sentences, it’s a big indicator you’ll get your problem solved.
- Finally, you need to create a test suite to make sure the problem gets solved. The more robust the test suite, the better the solutions will be. Be sure to cover cases like empty value, repeat values, out of bounds values, etc.
- You can create an optional reference solution. Reference solutions are good if you’re providing a brain teaser that you’ve already solved. But if this is a problem you don’t know yet how to solve, feel free to leave it out.
- Publish it.
Try out the problem I created for Mark and try to beat my answer!
Just remember that Cody rates problems based on an approximation of code size, which may not be the best code for maintainable, reusable project.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.