This coding challenge is all about logic and problem solving. Since Coding Challenge #4 was such a success we are doing something similar again. You will get a chance to work on javascript logic problems and also see how others have solved similar problems. This way you can learn from each other! Please Use the #coding-challenge channel to discuss and share your work. At the end of the challenge, I will compile everyone's submitted answers onto github.(Ps, try to solve these yourself before going out on the internet and finding a copy paste solution)
Solve the below 3 javascript puzzles. The goal of this challenge is to practice our logic skills. Something that is useful not only in interviews when you get challenging problems, but also in your day to day work as a developer. First, start off by reading this article: https://medium.freecodecamp.org/how-to-think-like-a-programmer-lessons-in-problem-solving-d1d8bf1de7d2
Question 1: Clean the room function: given an input of [1,2,4,591,392,391,2,5,10,2,1,1,1,20,20]
, make a function that organizes these into individual array that is ordered. For example answer(ArrayFromAbove)
should return: [[1,1,1,1],[2,2,2], 4,5,10,[20,20], 391, 392,591]
. Bonus: Make it so it organizes strings differently from number types. i.e. [1, "2", "3", 2]
should return [[1,2], ["2", "3"]]
Question 2: Write a javascript function that takes an array of numbers and a target number. The function should find two different numbers in the array that, when added together, give the target number. For example: answer([1,2,3], 4)
should return [1,3]
Question 3: Write a function that converts HEX to RGB. Then Make that function autodect the formats so that if you enter HEX color format it returns RGB and if you enter RGB color format it returns HEX. Bonus: Release this tool as a npm package.
-
You have until June 30th at 11:59pm EST to submit your solution file (using Github. If you don't know how to do that, check out the lecture in the Git + Github section of the course). You will have to submit the link to the #coding-challenge Discord group with the following message: -challenge github.com// . The bot will listen for the command in any channel its in and will reply with "thanks for your submission" if it succeeded.
-
Use whatever tools you have as developers (google, friends, Discord, programming buddy etc...) but I will not be offering any help with this challenge. Just like a developer you must solve a problem and build something that will be challenging. Nobody will hold your hand during the job so we want to experience that by figuring it all out on your own!
*** Please note: As with all my challenges there is zero benefit or monetary gain I recieve from it. This is just my way of thanking my students and making sure that you are able to continue gaining valuable knowledge outside of just my videos. It would mean a lot to me if you are able to rate my course...5 star reviews make my day :)