/algo-exercises

Algo exercises – collected & curated, in JavaScript, tested with Jest, multiple solutions, setup with Wallaby.js

Primary LanguageJavaScript

Algo exercises

  • Collected & curated assignments from around the internets
  • Written in JavaScript
  • Tested with Jest
  • Multiple solutions
  • Ideal for exploring TDD tooling, e.g:

⚠️ BEWARE ⚠️ Coding exercises should only be used for the joy of solving them. Do not use them for hiring purposes! Ability to solve artificial quizzes is a horrible indicator of person's real-life coding skills.

Tips

  • Always start with pen & paper
  • Verify:
    • Edge cases on inputs
    • Limitations & assumptions given in assignment
    • Not obvious inputs (e.g. odd number of nodes for function that swaps adjacent nodes)
    • Coercing 0 to false in conditions (typeof x === 'undefined' instead of !x)
  • Optimization
    • Consider which checks are not needed due to input limitations from assignment
    • Consider sorting arrays first
    • Consider real need of all assertions
    • Consider reusing existing data structure instead of creating new ones (e.g. with swapping linked list nodes)
    • Consider recursion
    • When being extra smart, be also extra careful

Attributions

I'm not the original author of the assignments! I've just:

  • collected & curated them
  • reformatted them for better readability (subjective!)
  • rewritten examples into runnable tests + authored new ones
  • authored my own solutions
  • collected various other solutions for comparison
  • setup repo for plug'n'play experience

🎓 This repo is only for educational purposes
🙏 I've tried my best to add attributions where they were due.

Original sources:

Other repos

Related