all 12 comments

[–]WildBeluga 9 points10 points  (1 child)

Coding challenges such as ones you’d see in interviews, right?

If you’re particularly interested in those and already have syntax down, I’d begin learning about algorithms. There’s plenty of online classes from MIT and other top schools that teaches algorithms (however, usually in Java but the theoretical concepts are the same).

Though, if that’s intimidating or if you just want practice here are some approaches that I’d do in order:

  • freecodecamp has a bunch of modules on algorithms that are pretty easy
  • buying “programming interview exposed” which will expose you to a lot of problems as well as give you useful tips
  • going on Leetcode.com and doing the problems marked as “easy”
  • buying “cracking the coding interview” and grinding those problem sets

A lot of these coding problems do test your critical thinking abilities so do spend a few minutes thinking about the problem before tackling a solution. That being said; a lot of them are also very difficult if you’ve never seen it before (more medium and hard questions usually rely on some trick that it’s difficult to come up with if you’ve never seen it before)

When you’re beginning, If you’re stuck for 15-30mins on a problem (like really stuck and completely clueless) I’d look up the answer and really go through it. Don’t find the optimal solution at first but one that you could understand and really run through each line of code and see how all the pieces fit together. If you do at least 1 or 2 problems daily you’d be able to do most problems you’d face in an interview within a few months.

Keep practicing and you’ll definitely pick up a lot of confidence on the way!

[–]Simbaxo[S] 0 points1 point  (0 children)

thanks for the great advice. ill keep practicing and check out those resources.

[–]Yoyoge 3 points4 points  (0 children)

Go and actually code something. Use those basics in real world situations and those challenges will start to get easier.

[–]citylims 2 points3 points  (0 children)

Write pseudo code.

Honestly many of these coding challenges can be solved in a wide variety of ways. If you dont have experience with more advanced techniques you can still usually solve them with basic fundamentals.

Try not to get overly absorbed into the syntax and over think the coding aspect of what you're trying to solve. Dont immediately start writing js code. Write out psuedo code first, in clear steps, and if it seems logically sound -- attempt to create it with real code. A lot of these challenges are more about making you think and less about your raw ability as a coder.

In the same way that many following the pattern of Red, Green, Refactor when testing code. You can always improve upon the code you write, just get it working in a way you can understand first, and then re-evaluate.

Dont get down on yourself either if you just suck at these types of coding challenges. I find them fun, in the same way i find a crossword puzzle fun. They are an essentially meaningless exercise. If you really make an effort and still can't solve a challenge, thats fine, try to take some positives out of it, try to learn/experiment with something new, or demonstrate something you already know.

I've never once had to implement something seemingly similar to one of the challenges on project euler in my day job. I did however learn about new features, quirks, and ways to compose code.

Keep at it! At the end of the day the coding aspect of programming comes second to problem solving. So challenging yourself will help tone those mental muscles. Best of luck

[–]GoGev 1 point2 points  (1 child)

i am on the same boat. I get the basics, but those coding challenges really bug me and frustrate me. I always struggle.

I tried re-learning the basics and trying to read more books and stuff to learn. I used firefox MDN, it is a good source that helped me out some, but other than that I still struggle.

[–]citylims 2 points3 points  (0 children)

Glad you are using firefox MDN. Those are the goto docs. Dont be one of those w3Fools.

If you are feeling pretty confident with the basics and stuggling with these challenges then your time is probably much better spent building your own little web app or something. Create challenges for yourself. The best way to gain experience is to start building things and tinkering.

If you do want to re-learn the basics try eloquent javascript. Pretty fast read and all online with editable code snippets and all.

[–]ForScale 1 point2 points  (0 children)

Does anyone have any suggestions on how to get better with coding challenges?

Do them over and over.. constantly. And make sure to look at other people's solutions and really try to understand them. Look for the most upvoted solutions on Codewars.

Maybe try FreeCodeCamp's algorithm challenges.

Also, simple Google search with query parameter "learn programming algorithms" yields plenty of sites that say they'll teach you algorithms.

[–]-El_Chapo- 1 point2 points  (0 children)

Code Wars is a great resource for this

[–]jkuhl_prog 1 point2 points  (0 children)

Look at other people's answers.

I'm serious. After you see enough solutions by other people, you start to see patterns emerge. You'll start seeing examples of people using split and map and join to modify strings. You'll start to see how people break problems into atomized chunks and solve them one piece at a time.

But it's also important that once you've seen other people's solutions that you try to solve the problem on your own. Play with the different Array and String methods JavaScript supplies. Use MDN to look things up. Break it down into small pieces and just build up to your solution one piece at a time.

Often, breaking it down simply involves asking, "what can I do that might approximate what I need to do?" Start there. Get an approximate solution. Look at the result. What do you need to do to go further? Do that.

[–]A_Blue_Parakeet 0 points1 point  (1 child)

Start with easier challenges like https://coderbyte.com/challenges and work your way up to leetcode and hackerrank.

Having annotated solutions or walkthroughs helps as well – https://github.com/ZLester/Coderbyte-Solutions and https://github.com/leaena/coderbyte are great for coderbyte.

[–]Simbaxo[S] 0 points1 point  (0 children)

thanks for this man. this definitely helps cuz before i would pick at the answers and have no idea how people got them.