Intermediate algorithms is too hard

Hello,

I have completed Javascript and Basic algorithms in just few days, bet then i came to the Intermediate algorithms. I have completed the first one, but other ones are just too hard. I don’t want to read example code because in that way i will not learn anything. Even if I did read the one for the roman numerals I still don’t get how it works. I feel like there was a gap going from basic to intermediate. Is there any way to fullfill it ? Is there mabye some literature or courses which could help me to go over to the intermediate ? How did you guys were able to handle it ? Share some tips and hints of your experience.

Thanks :slight_smile:

2 Likes

You are absolutely right that they are much harder. Some of them took me days to complete, and I was thinking about them constantly!

The trick I found that helped was to try to write the steps down on paper and then try to research the appropriate javascript methods to perform each step.
Once I could figure out what steps I would take without a computer, finding the right javascript method was easier.

Take your time; don’t expect to solve them in 15 minutes (although you may surprise yourself with some of them); feel free to ask for a nudge in the right direction if you get stuck, or just want someone to bounce ideas off.

Good luck!

2 Likes

Yep, the gap from basic to intermediate is wide.

In the past I’ve solved algorithm problems for a month or two, so most of these aren’t too hard for me. Like most skills, it gets easier with practice. Some of them I found hard though (I’m looking at you, Steamroller challenge!)

Yes, don’t spend too much thinking in visualizing; use paper and pen to visualize and attack the problem. It works wonders.

If you’re stuck, walk away from the problem for a bit and unwind (or try solving a different problem). Then return with a fresher perspective.

Hi Gadzet,

Don’t give up! To address your question about intermediate steps- yes there are lots of algorithm challenge resources out there. My favorite is project euler: https://projecteuler.net/archives. These are basically math problems you solve with programming. They are difficult and take time but they will grow your ability to solve algorithmic puzzles. Do folks have others that they recommend?

If you want to develop a deeper understanding of javascript (useful here since many FCC algorithm challenges target particular features of JS) you could start working through You Don’t Know Javascript, which is free to read on github: https://github.com/getify/You-Dont-Know-JS . I’ve started the series recently and it’s made things like object.prototype, type coercion, and hoisting much clearer to me.

Breaking a problem down into steps is helpful as the complexity increases. Write down each step your program needs to do, then just complete the first step. I find this also results in cleaner, more general code than trying to solve everything at once.

1 Like

The trick to solving many of these problems is having suitable data structures. For example, the Roman Numeral problem becomes easy if you consider setting up data structures that draw a parallel between the base 10 system and Roman Numeral system. eg.

UNITS = [’’, ‘I’, ‘Il’, ‘Ill’, ‘VI’, ‘V’, …, ‘IX’];
TENS = [’’, ‘X’, ‘XX’,…,‘XC’];
HUNDREDS = [’’,‘C’, ‘CC’,…,‘CM’];
etc

This will simplify the algorithmic thinking

2 Likes

Use pen and paper. Write out your algorithm. Write the steps so you see how it should work. I cannot stress this enough: PEN AND PAPER are two staple things in algorithm solving, use them to your advantage.

Other than that, you’ll just need to bang your head against them until you break through. Research the methods you could use. Look at example code for those functions, even if they show a different example, it’ll help you understand them.

Most of all, if you get stuck super hard on one of them, switch up the pace with another one and come back later. Programming takes lots of banging your head against the wall, learning common practices and just … practice… practice practice. And use paper and pen.

You might want to supplement with an Intro to Computer Science course like CS50 or textbook that has a lot of examples/exercises that gradually increase in difficulty. The “downside” is they are often not taught with JavaScript (at least not entirely) so you likely need to set aside additional time to learn other languages like Python, Java, etc. But the underlying logic to solve a problem like the ones in FCC would be the same. In fact some classic intermediate-advanced algorithms books only use pseudocode in their examples.

Totally agreed… some of them required making a map and then simply using it …