MATLAB Community

MATLAB, community & more

Tapping the Community to Get Real Work Done

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:

  1. From Cody, press the big blue “Create a Problem” button.
  2. 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.
  3. 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.
  4. 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.
  5. Publish it.
  6. Profit!

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.

|
  • print

评论

要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。