Becoming Efficient at Toy Problems
Toy problems are brief exercises that emphasize formulating a quick solution to a task. They are questions that an employer might ask for an interview such as writing a sorting algorithm, string manipulation and/or concatenation, and implementing mathematical functions. Here are some tips for becoming more efficent in toy problems.
1) Formulate an idea and RAPIDLY test it as quickly as possible. Make a shell for the function you are
creating, and stick a console.log
statement inside. Call this function and makes sure it outputs the
statement.
2) Assuming you have inputs, change your console.log
statement to be something that log your inputs:
3) Include a variable for the result, usually a number, string, or integer, and formulate a first attempt at the calculation you want to make. Make sure to return this result
variable as well as log it to the console.
4) After seeing that this is not the correct out, refactor and try another solution:
Part 2 will include common toy problems that more are based on. Stay tuned!