![javascript problem solving github javascript problem solving github](https://the-winter.github.io/img/favicon-96x96.png)
Solve programming problems in Javascript or TypeScript! This site will only store your progress within your current web browser. To keep your solutions permanently, be sure to save your solution as a file.
![](http://presentationhelp.xyz/777/templates/cheerup2/res/banner1.gif)
javascript-problem-solving
There are many ways to solve a problem. This repository is a collection of different ways to solve a problem. The solutions are written in JavaScript. The solutions are not necessarily the best solutions, but they are solutions.
How to use this repository
Each problem is in its own folder. Each folder contains a README.md file that describes the problem. The README.md file also contains a link to the solution. The solution is in the solution.js file.
Level Indicators
The level indicators are used to indicate the difficulty of the problem. The indicators are:
- L-B - Level Beginner
- L-I - Level Intermediate
- L-A - Level Advanced
How to contribute
If you have a solution to a problem, please submit a pull request. If you have a problem that you would like to see solved, please submit an issue. We will be glad if you add your problem and solution to this repository. Get started by forking this repository.
- Fork this repository
- Clone your forked repository
- Create a new branch
- Add your problem and solution
- Commit and push your changes
- Create a pull request
How to add a problem
- Create a new folder with the problem name. ex: 0001 FizzBuzz ( L-B )
- Create a README.md file in the folder.
- Add the problem description in the README.md file.
- Add the problem added by section in the README.md file.
- Add the Reference link in the README.md file.
- Create a solution file named YourProblemName.js in the folder. ex: FizzBuzz.js
Follow this file for reference.
How to run the solutions
Each solution is written in JavaScript. You can run the solutions in your browser’s console or in Node.js or any IDE like VSCODE .
Problems Collection
You will find all the common/beginner level problems in this repository.
JS-99: Ninety-Nine JavaScript Problems Star on GitHub
![javascript problem solving github javascript problem solving github](https://raw.githubusercontent.com/leonardiwagner/z/master/z-logo.png)
Problem {{$index + 1}}
{{problem.description}}
JavaScript Coding Interview Practice – Sample Interview Questions and Solutions
![javascript problem solving github Damla Erkiner](https://www.freecodecamp.org/news/content/images/size/w60/2022/09/Screenshot-2022-09-14-at-21.24.06.png)
David Goggins is an ultramarathon runner, a public speaker, a retired navy SEAL, and the author of the book ' Can't Hurt Me: Master Your Mind and Defy the Odds '. He's one of my role models because of his physical strength and mental resilience.
You might say: "Wait a second! We get it. This person is obviously the epitome of success. But he has non-technical skills. So why is he relevant to JavaScript coding interviews?"
Well, if you're ready, let's explore this together.
Rocky Balboa As a Mentor
In response to a question, David says, 'The Rocky Movie changed my life." In that pep talk , he refers to this scene (min 1.30-1.42) where the fictional character, Rocky - despite being beaten up badly by his opponent in the final boxing round - refuses to give up no matter what.
David describes that particular moment as the time when Rocky - initially depicted as an underdog by the screenwriter - overcomes all the odds and strikes awe in his rival.
![javascript problem solving github image-280](https://www.freecodecamp.org/news/content/images/2022/08/image-280.png)
Let's admit it. Being a good programmer is not that easy. And especially if you are at the beginning of your career, technical job interviews can be seriously daunting. In short, it might be nice to reach David's (and Rocky's) mindset.
With that kind of drive and confidence, you're much less likely to consider giving up regardless of the types of challenges you face in your wonderful yet difficult journey of getting a developer job.
Why Coding Interviews Are Difficult
During coding interviews, you are expected to fix coding problems with some theoretical knowledge. But the caveat is you must do that in real time, which sometimes scares new developers off.
There are several types of coding interviews. But the most challenging one is probably a whiteboard interview. In these types of interviews, you have to code in front of a future employer / a senior software developer.
![javascript problem solving github image-319](https://www.freecodecamp.org/news/content/images/2022/08/image-319.png)
These interviews can be extra stressful because you are typically not allowed to have a computer to google any unknown concepts or to get some code snippets from the internet. You are only given a marker to solve the question on a whiteboard as the name suggests.
Do Interviews Reflect What You'll Do in Your Job?
Not necessarily. So why are they holding these scary coding interviews? Well, the reason is to test your problem solving skills in general. At times, finding the correct answer may not even be that important.
What matters is how you reach that conclusion / solution and which algorithms you prefer to use along the way. In other words, your ability to function well under stress is being tested by tech companies.
![javascript problem solving github image-329](https://www.freecodecamp.org/news/content/images/2022/08/image-329.png)
Let's face it. You'll come across lots of stressful situations in your future job, and how you deal with certain issues is especially crucial. Therefore, your future employer naturally wants to witness firsthand whether you are the right fit for the job.
What is the Purpose of This Tutorial?
In this post, I'll walk you through some popular JavaScript interview concepts through examples. I'll also do my best to show you what recruiters / interviewers might actually be looking for in a candidate while they code in front of them.
To simply put, we'll examine some models and try to solve the related puzzles together.
By the end of this tutorial, you'll hopefully have an idea about a number of important array methods. But most importantly, you'll unlock how to approach some coding challenges in the best way possible.
What Exactly is the Memory Palace Method?
Before we start, just be aware that in the sample data down below, I've used some late celebrities' names intentionally so that all those details can be catchy in the long run.
An ancient technique called the Memory Palace clearly says that the weirder the details, the easier it is to remember them – and a made-up story / creating context is even more effective.
If you try to visualise the related situation vividly and associate the given programming concepts with some bizarre details in your mind, you might feel less stressed and confused when you see a similar problem next time. This is because it might be easier for you to create specific links and as such remember things easily. This is how our brains work.
Well, even the fictional figure ' Sherlock Holmes ', the smartest guy on the planet, benefits from this method when solving complicated crimes – so why shouldn't we?
![javascript problem solving github image-321](https://www.freecodecamp.org/news/content/images/2022/08/image-321.png)
How to Approach Coding Problems
In our imaginary interview, you'll see that four extraordinary musicians from the past are listed as passengers on a flight. We have their food choices and the number of connecting flights they need to take after their incredible performances on stage in different parts of the world.
Let's say just for the sake of argument our phenomenal figures (Freddie Mercury, Amy Winehouse, Kurt Cobain, and Michael Jackson) are about to fly from different destinations to Los Angeles just to be able to dine out together at a swanky restaurant, as they enjoy each other's company so much.
After all, this is our own private memory palace, so we can absolutely do whatever we want to do in our minds. Remember unusual details will stick better. That's why I'm trying to add more to spice things up.
This method explicitly suggests describing every single detail with some vivid adjectives so that you can associate them with the things you plan to learn in the long run.
Scientists say short term memory and long term memory function very differently. To put it simply, we need a way to put all those core concepts (not necessarily the syntax) about programming in our long term memory. That's why it can be nice to benefit from the memory palace method in our journey.
![javascript problem solving github image-326](https://www.freecodecamp.org/news/content/images/2022/08/image-326.png)
Plus, I feel like you get to picture this unusual scenario with a smile on your face. Well, wouldn't it be great if these awesome souls could have seen that they are now helping us / the programming community as the guests of a freeCodeCamp article?
Sample Interview Questions
Let's get back to the real life now though. Remember you're still in the interview and as you see below, three questions in a row are waiting for you.
To solve the puzzles, you're expected to use the data inside the following array of objects in practical ways.
You'll certainly need to come up with the right algorithms and try to find the most effective solution that can satisfy the interviewer.
The above questions are in fact not that hard. But, how we'll handle them is a great opportunity to compare alternative solutions for a single problem. At the end of the day, quality is what counts for recruiters / interviewers.
Interview Question 1: How to Get Passengers' Names
Let's get the passengers' names as requested. The first solution is through a 'for loop' method. So we first need to use an empty array to push the passengers' names right inside it at the end of the loop.
Below, [i] represents the current passenger and we simply loop through the 'passengers' array to access the names of the passengers. Then, we need to lock them up in our empty array / passengerNames.
![javascript problem solving github image-331](https://www.freecodecamp.org/news/content/images/2022/08/image-331.png)
Alright, we solved the puzzle, but is it enough? Or might the interviewers expect you to come up with a better solution?
Alternative Solution #1:
We can reach the desired result by using the ' forEach ' function as well. This solution is even a bit better than the previous one because there is no index expression in this one.
![javascript problem solving github image-332](https://www.freecodecamp.org/news/content/images/2022/08/image-332.png)
To benefit from 'forEach', we need a callback function . With this arrangement, we are able to reach every passenger in the list. However, just like in the previous solution, we first need an empty array to push the items / passengers' names.
Even though the result is the same, this piece of code is shorter. Writing neater codes is what is – in fact – expected from you.
In other words, not only the solution matters, but also how you reach it is being evaluated by the recruiters. For this reason, it is a good idea to plan your action rather than writing the first idea in your mind on the whiteboard.
Alternative Solution 2:
Here comes the best solution. We can also utilise the ' map ' function to tackle the same problem. Let's see how.
![javascript problem solving github image-333](https://www.freecodecamp.org/news/content/images/2022/08/image-333.png)
The map function also loops through the array and returns a new array for every item in the list. With this set-up, we simply return a single element, not an object.
The result will again be the same in the console, but your code will even be better than the first and second one because this time, we don't need to create an empty array before the actual task.
Here is the food for thought on this topic. Those who say 'less is more' have a point when it comes to writing codes.
Interview Question 2: How to Get Vegetarian/Vegan Singers
Let's now take a look at the next challenge. The new task asks us to obtain only the vegetarian / vegan singers from the passengers' list by also keeping the first argument in the main question section.
How to Solve With a 'For Loop'
Again, we can use the same old 'for loop' for this one as well. All we need to do is to check whether there are any vegetarian / vegan singers in our passenger list through an 'if' statement inside our existing function.
![javascript problem solving github image-334](https://www.freecodecamp.org/news/content/images/2022/08/image-334.png)
We do that with the isVegetarianOrVegan property in our object. Basically, what we say is this: if the relevant statement is true (if there are any vegan / vegetarian passengers in the list), just push those items into our new array. The result will give us three singers' names as those are listed as 'vegetarian or vegan' in the data part.
How to Solve with 'forEach'
As a matter of fact, the 'forEach' function handles the problem similarly. But once again, it has too many lines of codes as you see below, so it isn't the ideal version.
![javascript problem solving github image-335](https://www.freecodecamp.org/news/content/images/2022/08/image-335.png)
How to Solve with 'Filter' & 'Map'
To come up with the best option, this time, we will use two different methods. The ' filter ' and the 'map' functions will – in a way – collaborate to create better logic when solving the given problem. Let's examine the following code snippet closely now.
![javascript problem solving github image-336](https://www.freecodecamp.org/news/content/images/2022/08/image-336.png)
With the filter method, we only get the vegetarian / vegan passengers from our array in the first place. If it finds some non-vegetarian / vegan passengers (like our beloved 'Freddie'), it will get rid of them automatically.
Briefly, the first part of the equation, the 'filter' method will simply work through 'yes' or 'no' model.
Then, the 'map' function will come in, eventually giving us a brand new array showing the vegetarian / vegan passengers only.
This final solution will prove your future employer that you genuinely know what you're doing and you are really taking the right steps to be a hotshot developer.
Interview Question #3: How to Sort Passengers by Connecting Flights
The last section asks us to sort the list of our super cool passengers by the number of the connecting flights they'll take to eventually reach LA. Let's see who has more and as such, will be pretty exhausted.
Spoiler alert! Amy with four connecting flights in total might be a bit sleepy in the get-together at that fancy restaurant. But there is no doubt that she will somehow rock where ever she goes.
![javascript problem solving github image-322](https://www.freecodecamp.org/news/content/images/2022/08/image-322.png)
Anyway, what we need for this task is to know how the ' sort ' function operates.
Primarily, it compares items one by one and returns something as a result. In our case, it will be the number of connected flights. But how does it make that comparison? What is the logic behind that?
![javascript problem solving github image-343](https://www.freecodecamp.org/news/content/images/2022/08/image-343.png)
The above lines of code are pretty clear in general. Thanks to the 'sort' function, we list those months in alphabetical order.
Well, here comes the big question. How does the code / system know that 'a' is the first letter of the alphabet and as such, the list starts with the 'd' letter (December)?
The reason is that the 'sort function' lists things in ascending order by default. But can't we change this setting? Perhaps, we need to list items in descending order. Of course, we can.
Let's see how. To achieve what we want, we may utilise 'a' and 'b' letters as parameters leading to different directions.
![javascript problem solving github image-338](https://www.freecodecamp.org/news/content/images/2022/08/image-338.png)
Simultaneously, we can benefit from the assistance of three numbers: -1,+1, 0 as seen above. When sorting items in descending or ascending order or finding the equal values, they can be quite handy.
Tricky Bit of the 'Sort' Function
In the following example, the list is sorted in ascending order. Why is it like that? Here is the reason. When we return those 'a' and 'b' parameters, we use this order: 'a - b' . That gives us ascending values by default.
![javascript problem solving github image-339](https://www.freecodecamp.org/news/content/images/2022/08/image-339.png)
However, if we swap them and say 'b - a', the list will be seen in descending order this time. That's the tricky bit when it comes to the 'sort' function.
In the above example, the first version (regular function) and the second one (arrow function) are in essence the same, but just be aware that arrow functions came with ES6 .
Although arrow functions help developers to write less code, you cannot use them everywhere. (Read this to find out when to use them.)
Testing Our New Knowledge
Shall we now analyse the situation of our passengers through our new perspective? We know that the last task asks us to sort the number of flights in descending order. But the following set-up does the opposite.
It can only give us the list in ascending order. Why? It's simply because of the pre-defined order (passenger1.connectedFlights - passenger2.connectedFlights) as in the case of a - b example.
Once we swap the order (passenger2.connectedFlights - passenger1.connectedFlights) as you see in the following code snippet, our problem will be solved and the list will come in descending order.
![javascript problem solving github image-342](https://www.freecodecamp.org/news/content/images/2022/08/image-342.png)
Can We Also Use 'for loop' or 'forEach'?
Well, yes and no. Both would be low-level solutions for this question.
We should keep in mind that the sort function mutates an array. This is a kind of side effect which changes the original array and that might be a problem if we use 'for loop' or 'forEach' as a solution.
There are of course ways to avoid mutation in the sort function, but in our example, it will lead to more lines of codes, which is not practical at all.
![](http://presentationhelp.xyz/777/templates/cheerup2/res/banner1.gif)
Wrapping Up
We've started the article with David Goggins, the symbol of resilience and grit, so let's end it with his inspiring presence and ideas.
If you happen to read this modern day hero's book or listen to one of those famous podcast episodes (For example, this one ) where he was a guest speaker, you'll immediately understand that he wasn't born that way. Rather, his secret lies in the fact that he never gives up, against all odds.
Coding interviews are tough, but if you keep going after your goals by visualising the scene of success in your mind over and over again, it will - sooner or later - be yours.
![javascript problem solving github image-328](https://www.freecodecamp.org/news/content/images/2022/08/image-328.png)
Many thanks for reading this post. If you've liked this article, one of the best ways to support me is to share it. Should you have any questions or comments, you can always contact me via LinkedIn . I'll be more than happy to help you out with your queries.
Happy coding!
“Knowledge is power.” – Francis Bacon
Software Developer || UI Designer || Technical Writer
If you read this far, thank the author to show them you care. Say Thanks
Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started
10 JavaScript Snippets for Solving Common Problems
Published on May 24, 2022
![javascript problem solving github useful JavaScript snippets](https://runjs.app/static/blog/og/javascript-snippets-for-common-problems.png)
Utility libraries are great but sometimes they can be overkill. This is especially true when you're only looking for a simple solution to a common problem.
In this article, I've put together a list of common problems that JavaScript developers often face and the snippets you can use to solve them.
1. Create an array of key-value pairs from an object
This example uses the keys method from Object and the map method from Array to map over an Object’s keys and create an array of key-value pairs.
2. Remove falsey values from an array
The Array filter method is used here to cast all values of an array as a boolean and create a new array of only truthy values.
3. Get the difference in days between two dates
The start date is subtracted from the end date to get the difference in seconds. The difference is then divided by the number of seconds in a day to get the difference in days.
4. Find the difference between two arrays
This solution creates a set from one array which is then compared against the other array using the Array filter method. The use of Set here is an optimisation that is more efficient when dealing with larger arrays.
5. Convert an array to CSV
The Array map method is used to iterate over each level of the array and join each value with a defined delimiter.
6. Count the occurrences of an item in an array
The Array reduce method is used to loop over the array and increment an accumulator value each time the target value matches the current value.
7. Capitalize the first letter of a string
The string is cast to an array and deconstructed. The first element in the array is the first letter and the toUpperCase method is used to convert it to uppercase while the rest of the array is joined as a string.
8. Get the largest numbers in an array
The Array sort method is used to order the arraying into descending order. The slice method is then used to extract the first elements, which will be the highest numbers.
9. Average an array of numbers
The Array reduce method is used to loop over the items in an array and add each value to an accumulator. The accumulated value is then divided by the number of items in the array, producing an average.
10. Check if a string is valid JSON
The JSON parse method is used to parse the string to JSON and if it is invalid, an error will be thrown. The try-catch statement is used to catch this error and return false and otherwise true.
Final thoughts
Join the runjs mailing list.
You'll receive an occasional newsletter with development updates and articles from the blog. Unsubscribe at any time.
Recent posts
- How Do I Download JavaScript? Demystifying the Basics
- 17 Equations that Changed the World - Rewritten in JavaScript
- 6 Best Code Editors for JavaScript (2023): A Comprehensive Guide
- How to use the ChatGPT JavaScript API - 3 Easy Steps (2023)
- 10 Chrome DevTools Tips and Tricks
- How Hoisting in JavaScript Works
Exercise 1A: JavaScript Problem Solving
Write JavaScript code to solve the following problems (you may recognise these …). Where a code asks for numerical input from a user you can just ‘hard-code’ this input into your answer:
Write some code to print out all the numbers from 1 to 10
Write some code that prints out only the even numbers between 1 and 10
Write some code that prints out only the even numbers between 1 and 1000
The opposite of a number is the number itself with its sign reversed. For example, the opposite of 1 is -1. The opposite of -6 is 6. Write some code that takes a numerical value and prints out the opposite of that number.
Write some code that prints out the numbers between 1 and 1000, but if the number is divisible by 3 it prints ‘fizz’, if the number is divisible by 5 it prints ‘buzz’ and if the number is divisible by 3 and 5 it prints ‘fizzbuzz’
A square number is the product of a number multiplied by itself. Write some code that takes a numerical value and prints out all the square numbers below that value.
The Fibonacci sequence starts with the values 1, 2. The next number in the sequence is generated by summing the previous 2 values, so the first 5 numbers in the sequence are: 1, 2, 3, 5, 8, … a. Write some code to generate the first 100 values in the Fibonacci sequence b. Write some code to add up only the even values in the first 1000 values of the Fibonacci sequence
The sum of digits of a number is found by adding all the digits of a number together. For example, the sum of digits of 234 is 2 + 3 + 4 = 9. Write some code to take a numerical value and print out the sum of digits of that number.
Next: Exercise 1B: JavaScript Problem Solving
Previous: Using functions
15 Best Platforms To Practice JavaScript self.__wrap_b=(t,n,e)=>{e=e||document.querySelector(`[data-br="${t}"]`);let a=e.parentElement,r=R=>e.style.maxWidth=R+"px";e.style.maxWidth="";let o=a.clientWidth,c=a.clientHeight,i=o/2-.25,l=o+.5,u;if(o){for(;i+1 {self.__wrap_b(0,+e.dataset.brr,e)})).observe(a):process.env.NODE_ENV==="development"&&console.warn("The browser you are using does not support the ResizeObserver API. Please consider add polyfill for this API to avoid potential layout shifts or upgrade your browser. Read more: https://github.com/shuding/react-wrap-balancer#browser-support-information"))};self.__wrap_b(":Rid9j6:",1)
HackerEarth
Freecodecamp, geeksforgeeks, educative.io, codeacademy, javascript questions – by lydia hallie, javascript coding practice – by learning zone, 123 essential javascript questions – by yuri katkov, javascript interview question – by sudheer j.
![javascript problem solving github 15 Best Platforms To Practice JavaScript](https://wsrv.nl/?url=https%3A%2F%2Fcodedamn-blog.s3.amazonaws.com%2Fwp-content%2Fuploads%2F2022%2F09%2F25175651%2F15-Platforms-To-Practice-JavaScript.png&w=1280&q=82&output=webp)
Learning any programming language is not enough, and we need to practice.
If you are learning JavaScript, I have curated the ten best platforms to practice JavaScript for free.
![javascript problem solving github](https://wsrv.nl/?url=https%3A%2F%2Fcodedamn-blog.s3.amazonaws.com%2Fwp-content%2Fuploads%2F2022%2F09%2F23210801%2Fcodedamn-logo-with-text-red-1024x499.png&w=1920&q=75&output=webp)
Codedamn is an interactive programming platform; you will learn and build projects side by side. It offers over 500+ coding problems for you to practice.
You can solve 3-5 questions daily without waiting another day to solve more questions.
Codedamn has community support, if you get stuck on a particular problem, you can ask for help, and developers will be ready to help you anytime.
The problem’s difficulty level ranges from easy to hard. But you can go at your pace.
Here is the link to solve 500+ JavaScript problems .
If you think these problems are too advanced, you can learn about JavaScript basics, which codedamn offers for free.
Link to learn JavaScript: JavaScript basics
![javascript problem solving github](https://wsrv.nl/?url=https%3A%2F%2Fcodedamn-blog.s3.amazonaws.com%2Fwp-content%2Fuploads%2F2022%2F09%2F23211018%2Fcodewars-logo.png&w=1920&q=75&output=webp)
On codewars, you will get all types of questions ranging from easy to complex.
You will get instant feedback on your answers. Your rank will level up as you progress.
If you get stuck, codewars have a senior developers community that will help you.
Link to practice on codewars
![javascript problem solving github](https://wsrv.nl/?url=https%3A%2F%2Fcodedamn-blog.s3.amazonaws.com%2Fwp-content%2Fuploads%2F2022%2F09%2F23211113%2Fcodingame.png&w=1920&q=75&output=webp)
codin games is a gamified learning platform. On codin games, you will code and execute the correct code to save yourself from obstacles and enemies.
You can compete individually or by teaming up with other fellow developers.
You can compare your and other developer code to improve your JavaScript coding skills.
You can play and build your developer profile, and You can even apply for jobs. You need to solve complex problems and be consistent on the platform to stand out from others.
Link to practice on the codin game.
If you don’t know Solo Learn, you are not a developer. Earlier, Solo learn was only available as a mobile application, and now you can also learn on the web.
Solo learn offers a JavaScript course and exercise to improve your JavaScript coding skills.
At the end of each topic, you will get practice problems you need to solve to unlock the next section.
Link to practice on Solo learn .
![javascript problem solving github](https://wsrv.nl/?url=https%3A%2F%2Fcodedamn-blog.s3.amazonaws.com%2Fwp-content%2Fuploads%2F2022%2F09%2F23211918%2Fedabit-1024x538.png&w=1920&q=75&output=webp)
Edabit has interactive exercises ranging from easy to complex, and you can filter the challenges using tags. You can practice your JavaScript coding skills for free.
If you get stuck on any question, you can unlock the solution, but you will lose the XPs you have gained.
Alternatively, the resources tab contains the concepts to learn to solve that problem.
Link to practice JavaScript at edabit.
![javascript problem solving github](https://wsrv.nl/?url=https%3A%2F%2Fcodedamn-blog.s3.amazonaws.com%2Fwp-content%2Fuploads%2F2022%2F09%2F23211352%2Fhackerearth-logo-300x300.png&w=1920&q=75&output=webp)
Hacker earth has a set of questions based on if you are preparing for an interview or you are a beginner at programming ,
It has a codemonk section where you will get questions based on Data Structures and algorithms. Best suited if you know DSA and algorithms, or you can practice easy and medium-difficulty problems.
On hacker earth, you can participate in challenges, try to build your developer profile, and stand out from other developers. And apply for jobs at companies.
Link to practice at HackerEarth
![javascript problem solving github](https://wsrv.nl/?url=https%3A%2F%2Fcodedamn-blog.s3.amazonaws.com%2Fwp-content%2Fuploads%2F2022%2F09%2F23211534%2Fprogramiz-logo.png&w=1920&q=75&output=webp)
On programiz, you can practice JavaScript for free, and You will get the list of concepts to learn and practice problems at the end of each concept to retain what you have learned.
There are separate JavaScript examples sections available there, and you will find the JavaScript-related question and some general programming questions based on the topics you have learned.
Link to practice JavaScript examples at programiz.
![javascript problem solving github](https://wsrv.nl/?url=https%3A%2F%2Fcodedamn-blog.s3.amazonaws.com%2Fwp-content%2Fuploads%2F2022%2F09%2F23211613%2Ffreecodecamp-logo.png&w=1920&q=75&output=webp)
Freecodecamp is popular among developers because of its ocean of totally free courses.
Freecodecamp offers 100s of exercises related to JavaScript, ranging from basic concepts, regular expressions, array methods, objects, data structure, and algorithms.
These exercises are for beginners to advanced javascript developers.
Link to practice on freecodecamp
![javascript problem solving github](https://wsrv.nl/?url=https%3A%2F%2Fcodedamn-blog.s3.amazonaws.com%2Fwp-content%2Fuploads%2F2022%2F09%2F23211656%2Fgeeks-for-geeks-logo.png&w=1920&q=75&output=webp)
To practice on GeeksforGeeks, you need to create an account once you create an account with them, head over to the below link to practice JavaScript.
This platform best suits you if you have Data Structure and algorithms knowledge.
You can filter out the problems based on the companies that have asked about that problem or on the concepts like Arrays, Objects, and Strings.
You can even choose the problem difficulty level from school to pro level.
Link to practice on GeeksforGeeks
![javascript problem solving github](https://wsrv.nl/?url=https%3A%2F%2Fcodedamn-blog.s3.amazonaws.com%2Fwp-content%2Fuploads%2F2022%2F09%2F23211805%2Feducative-logo.png&w=1920&q=75&output=webp)
The Educative has an assessment test. You can take the JavaScript assessment test, which takes around 20 minutes to complete.
The assessment test consists of all the topics, from fundamental concepts like variables, data types, and conditional statements to advanced concepts like arrays and objects.
Link to the assessment test
![javascript problem solving github](https://wsrv.nl/?url=https%3A%2F%2Fcodedamn-blog.s3.amazonaws.com%2Fwp-content%2Fuploads%2F2022%2F09%2F25175256%2Fcodecademy-logos-idVjFQVjQy.png&w=1920&q=75&output=webp)
On Codecademy, you will find a javascript project-based course that is very helpful if you want to learn and build projects at the same time using javascript.
Link to javascript courses
I have curated four GitHub repositories that are helpful. You will gain problem-solving skills, and some repositories will help you prepare for the interview.
This repo has more than 500+ questions with answers, and this repo is available in 18 other languages. In this repo, you will find basic to very advanced questions, and some are very difficult.
Link to repo
This repo has more than 100+ javascript exercises with the answers. This repo will give you insights into How the recruiter will ask questions in a javascript-related interview.
You will find 123 essential javascript interview-related questions, which you can practice on your code editor or online to crack practical interviews. This repo has 4K stars, and you will find some exciting questions that might help you build problem-solving skills.
You will find 1000+ questions ? related to javascript on this repo, which you can practice. Questions range from the difficulty level of beginners to advanced.
I hope you found this article helpful, You can choose any platform and practice it to improve your developer profile, gain problem-solving skills and move to the next platform.
Thanks for reading.
Sharing is caring
Did you like what Mujahid Khan H A wrote? Thank them for their work by sharing it on social media.
No comment s so far
Curious about this topic? Continue your journey with these coding courses:
711 students learning
Laurence Svekis
Practice JavaScript by building 10+ real projects
152 students learning
DINESH KUMAR REDDY
JavaScript from Zero to Hero with 5+ projects
124 students learning
Shubham Sarda
Mastering Advanced JavaScript
Instantly share code, notes, and snippets.
see-why / PasswordDecrypt.js
- Download ZIP
- Star ( 2 ) 2 You must be signed in to star a gist
- Fork ( 0 ) 0 You must be signed in to fork a gist
- Embed Embed this gist in your website.
- Share Copy sharable link for this gist.
- Clone via HTTPS Clone using the web URL.
- Learn more about clone URLs
- Save see-why/6e16b7a27b1438607e972c895beb04aa to your computer and use it in GitHub Desktop.
function decryptPassword(s) { | |
// Write your code here | |
let find= '*'; | |
let replace = ''; | |
while( s.indexOf(find) > -1) | |
{ | |
var s = s.replace(find, replace); | |
} | |
let index = s.split('').findIndex(item => /[A-Z|a-z]/i.test(item)); | |
let i=0, r = s.slice(0,index); | |
r = r.split('') | |
s = s.slice(index, s.length).split('') | |
while( s.indexOf('0') > -1){ | |
let post = s.indexOf('0') | |
s[post] = r.pop() | |
} | |
let pattern = /[A-Z]/ | |
let pattern_lower = /[a-z]/ | |
for (let i=s.length-1; i<=0 ; i--){ | |
if(isNaN(s[i])){ | |
if((i+1) < s.length && pattern.test(s[i]) && pattern_lower.test(s[i-1])){ | |
let temp = s[i] | |
s[i] = s[i-1] | |
s[i-1] = temp | |
i -= 1 | |
} | |
} | |
} | |
return s.join('') | |
} |
cuchakma commented Jun 3, 2022
solution is wrong i guess
Sorry, something went wrong.
see-why commented Jun 3, 2022
please share why...
cause sometime hackerrank changes the questions
I see thanx for responding, your solution is not bad :)
thanks...we could look at the challenge together if you'd like
cuchakma commented Jun 4, 2022
@see-why I am ready to go, Let's connect and start solving problems. I have no problem :), how shall I contact you?
see-why commented Jun 7, 2022 • edited Loading
we can connect via Twitter or LinkedIn handles, please drop either and I'll reach out
cuchakma commented Jun 7, 2022
@see-why here is my Linkedin profile https://www.linkedin.com/in/cupid-chakma/ , looking forward to collaborate :)
see-why commented Jun 7, 2022
dinarakhay commented Jul 18, 2022 • edited Loading
I think you shouldn't have got rid of '*'s in the first place. Caz they are the indicators for switching previous letters (if upper and lower)
TundeMercy commented Sep 25, 2022 • edited Loading
@dinarakhay , I think you're right, removing the '*'s in place will make you lose track of where the swap(s) happened
TundeMercy commented Sep 25, 2022
Checkout my solution here https://github.com/TundeMercy/hackerRankChanlleges/blob/main/src/PasswordDecryption.java
Any idea for optimization is welcome 🙏
2471A05B3 commented Jun 2, 2023
function decryptPassword(s) { // Write your code here let find= '*'; let replace = '';
![](http://presentationhelp.xyz/777/templates/cheerup2/res/banner1.gif)
IMAGES
VIDEO
COMMENTS
Add this topic to your repo. To associate your repository with the javascript-problem-solving topic, visit your repo's landing page and select "manage topics." GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects. ... JavaScript Problem Solving is an open-source project. This project focused to JavaScript beginner level problem, task, solution.
Solve programming problems in Javascript or TypeScript! This site will only store your progress within your current web browser. To keep your solutions permanently, be sure to save your solution as a file. Save All Solutions Load Saved Solutions.
There are many ways to solve a problem. This repository is a collection of different ways to solve a problem. The solutions are written in JavaScript. The solutions are not necessarily the best solutions, but they are solutions. How to use this repository. Each problem is in its own folder. Each folder contains a README.md file that describes ...
JS-99: Ninety-Nine JavaScript Problems. These are JavaScript translation of famous functional programming series Ninety-Nine problems already done in Haskell, List, Prolog and Scala . Even though JavaScript has some functional aspects, probably no one did this before due the lack of some functional features, specially pattern matching.
Codility Solutions in JavaScript. GitHub Gist: instantly share code, notes, and snippets. ... FrogJmp Problem can be solved in O(1) time . Solution: function solution(X, Y, D) ... Here's another way of solving Lesson 2 - CyclicRotation with recursion:
Interview Question 1: How to Get Passengers' Names. Let's get the passengers' names as requested. The first solution is through a 'for loop' method. So we first need to use an empty array to push the passengers' names right inside it at the end of the loop.
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects. ... Add a description, image, and links to the problem-solving-javascript topic page so that developers can more easily learn about it. ...
Utility libraries are great but sometimes they can be overkill. This is especially true when you're only looking for a simple solution to a common problem. In this article, I've put together a list of common problems that JavaScript developers often face and the snippets you can use to solve them. 1. Create an array of key-value pairs from an ...
Some tips and steps to solve basic problems with "JavaScript" - javascript_foundations.md
Exercises. Write JavaScript code that finds all the words in words.txt with three consecutive double letters. Write JavaScript code to check whether a given number is Oddish or Evenish. A number is called "Oddish" if the sum of all of its digits is odd, and a number is called "Evenish" if the sum of all of its digits is even. Next: Arrays.
Follow these instructions: Store the values 3 and 5 into variables a and b, respectively. Multiply a and b and store the result into c. Divide b by a and store the results into d. Print a, b, c, and d. Update the values of a, b, c, and d as follows: Divide c by b. Multiply d by a. Increment a by 1.
Exercise 1A: JavaScript Problem Solving. Write JavaScript code to solve the following problems (you may recognise these …). Where a code asks for numerical input from a user you can just 'hard-code' this input into your answer: Write some code to print out all the numbers from 1 to 10. Write some code that prints out only the even numbers ...
The problem's difficulty level ranges from easy to hard. But you can go at your pace. Here is the link to solve 500+ JavaScript problems. If you think these problems are too advanced, you can learn about JavaScript basics, which codedamn offers for free. Link to learn JavaScript: JavaScript basics. Codewars
Add this topic to your repo. To associate your repository with the js-problem-solving topic, visit your repo's landing page and select "manage topics." GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 330 million projects.
JavaScript Problem solving. GitHub Gist: instantly share code, notes, and snippets. JavaScript Problem solving. GitHub Gist: instantly share code, notes, and snippets. ... JavaScript Problem solving Raw. HR JS.txt This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review ...
FullStack.Cafe is a biggest hand-picked collection of top Full-Stack, Coding, Data Structures & System Design Interview Questions to land 6-figure job offer in no time. Check 25+ JavaScript Coding Interview Questions (SOLVED with CODE) and Land Your Next Six-Figure Job Offer! 100% Tech Interview Success!
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects. ... 🚀 Collection of Leetcode Solutions using TypeScript & JavaScript. Practicing problem solving, data structure and algorithm. I am open for marathon challenges 🙋🏻♂️. js ts dsa problems ...
Hackerrank Challenge: Password Decryption. GitHub Gist: instantly share code, notes, and snippets. Hackerrank Challenge: Password Decryption. GitHub Gist: instantly share code, notes, and snippets. ... Let's connect and start solving problems. I have no problem :), how shall I contact you?
👼 Watch me BEAT THE LIVING HELL out of my weakness (Competitve Programming Style Problem Solving) - amir-kedis/problem-solving-solutions
Her some of problem i want to solve in javascript. Contribute to ibrahimratrout/Problem-Solving-JS development by creating an account on GitHub.
Contribute to Mominul36/problem-Solving development by creating an account on GitHub.
solving an unusual problem with neural network. Contribute to saeideh-j/arrangement_nn_groups development by creating an account on GitHub.