-
Notifications
You must be signed in to change notification settings - Fork 0
Algorithm Style Guide
Writing Algorithm challenges is a great way to exercise your own problem solving and testing abilities. It is a simple three step process.
- Fill out the generator form and test your challenge.
- Once you have confirmed a working Algorithm challenge in the generator, copy and paste the fields into the JSON generator.
- Copy the JSON, fork the freecodecamp repository, and submit a pull request with your addition to the challenge .json file.
Name your challenge
Attempt to rate difficulty compared against existing Algorithm challenges.
TODO: add basic quantifiers for each difficulty level
Separate paragraphs with a line break. Only the first paragraph is visible prior to a user clicking the "More information" button.
All necessary information must be included in the first paragraph. Write this first paragraph as succinct as possible. Subsequent paragraphs should offer hints or details if needed.
If your subject matter warrants deeper understanding, you may link to Wikipedia.
This is important.
Leave this field blank. It will soon be removed from the generator.
These tests are what bring your challenge to life. Without them, we cannot confirm the accuracy of a user's submitted answer. Choose your tests wisely.
Algorithm tests are written using the Chai.js assertion library. Please use the should
and expect
syntax for end user readability. As an example of what not do to, many of the original Algorithm challenges are written with assert
syntax and many of the test cases are difficult to read.
If your Algorithm question has a lot of edge cases, you will need to write many tests for full coverage. If you find yourself writing more tests than you desire, you may consider simplifying the requirements of your Algorithm challenge. For difficulty level 1 through 3, you will generally only need 2 to 4 tests.
If you found this page useful, you can give thanks by copying and pasting this on the main chat: Thanks @brandenbyers @Rafase282 for your help with the Algorithm Style Guide
NOTE: Please add your username only if you have added any relevant main contents to the wiki page. (Please don't remove any existing usernames.)
Learn to code and help nonprofits. Join our open source community in 15 seconds at http://freecodecamp.com
Follow our Medium blog
Follow Quincy on Quora
Follow us on Twitter
Like us on Facebook
And be sure to click the "Star" button in the upper right of this page.
New to Free Code Camp?
JS Concepts
JS Language Reference
- arguments
- Array.prototype.filter
- Array.prototype.indexOf
- Array.prototype.map
- Array.prototype.pop
- Array.prototype.push
- Array.prototype.shift
- Array.prototype.slice
- Array.prototype.some
- Array.prototype.toString
- Boolean
- for loop
- for..in loop
- for..of loop
- String.prototype.split
- String.prototype.toLowerCase
- String.prototype.toUpperCase
- undefined
Other Links