Wednesday, March 15, 2017

Day 60

Current Challenge: Show the Local Weather

Progress: I've finally managed to overcome all Advanced Algorithm obstacles! HELL YEAH!

At last, I was also able to crack the "No repeats please challenge" implementing the Heap Algorithm in a recursive manner. However, I did not make use of the pseudocode on Wikipedia but instead found a useful video on youtube laying out the code both in a visual fashion and using Python. The key task here was to transfer the idea into a working Javascript program and to actually understand what's going on. Another resource which I think might be useful to some folks is a post on the FCC forums since it provides some more general suggestions on how to approach the problem. Additionally, you might want to check out the FCC Algorithm challenge guide. There you can find more tips and tricks as well as the solutions, in case you are on the verge of going bananas. ;-) Last but not least you can find my code on GitHub (which may not be perfect yet).

Thoughts: I'm relieved that I can eventually leave the Algorithm section behind me. It was pretty frustrating at times and almost made me throw my laptop against the wall several times. But it was worth not giving up, because I feel much more comfortable with Javascript now, though I'm quite aware that despite all the progress there is still much, much more to absorb.

I guess I'm well equipped now to tackle the last part of the FCC Front End route before finally obtaining the Certificate: completing the remaining projects. I figured that due to my detour to the algorithm section I probably have to get reacquainted with some Bootstrap / Flexbox stuff as well as jQuery, which I still am not that much used to, partly due to the poor documentation and my reluctance to buckle down, since I'd like to focus more on vanilla JS for now (in the end, jQuery is just a JS library using a somewhat different syntax, which takes some time to get to know).

I'd also like to mention that I got accepted to join one one the CHINGU cohorts, called Iguana, starting off on Monday, March 20th. I'm pretty excited and looking forward to boosting my skills even further, build stuff and make some connections with other like-minded people around the world.

For those who are wondering what I'm actually talking about, check out the CHINGU page.

My plans for the next days:
  • Complete all Intermediate Front End Development projects
  • Start reading the YDKJS book series

Follow me on GitHub

Follow me on FreeCodeCamp

Monday, March 6, 2017

Day 52

Current Challenge: No repeats please
Progress: I've been pretty busy the last couple of days and hence hadn't much time to make real progress. However, I figured how to pass the "No repeats please" challenge by just using some combinatorics but could not manage to generalize the idea, which really caused some frustration. Unfortunately, I found this article on StackOverflow only after I already figured it out myself, which could have saved me quite some time spent on thinking. Still, one major issue remains: finding a generalizable formula that handles both an arbitrary set of repeating and non-repeating characters, like "aaabbbbcccccdeffg" for instance. The solution to the problem can be abstractly described as "TOTAL - INVALID + OVERLAPS".

As long as we only have one character set with just one repeat, we are done after subtracting the INVALIDs from the TOTALs.

"aab": 3! - (2! * 3!) = 2

"abcdefa": 7! - (2! * 6!)  = 3600

If more than one character set with repeating letters is occurring we have to take care of the OVERLAPS as well since we deduct some permutations twice (or more) when subtracting the INVALID ones:

"aabb": 4! - (2! * 3!) - (2! * 3!) + (2! * 2! * 2!) = 8

"abfdefa": 7! - (2! * 6!) - (2! * 6!) + (2! * 2! * 5!) = 2640

Things start to get hairy if you have something like "aabbccd", i.e. more than two character sets with repeating letters since you have to add back all the overlaps, which are not as easy computable as above.

The same goes for character sets with more than 2 repeats like "aaab". Those two issues combined, say we have something like "aaaabbbccd", is way too complicated to grasp at the moment due to the different grouping possibilities you have to account for. If I'm trying to compute it manually I'm sometimes right but more often than not wrong. The thing I can't get my head around is recognizing a pattern.

Thoughts: For now, since I haven't made any real progress and it continues to discomfort me, I'll focus on just passing the tests with the next best algorithm I come up with.

My takeaway from this challenge is that I spent way too much time on figuring something out I'm not supposed to. But it has been nagging me ever since I had the idea of a somewhat "universal" formula, where you can just toss in the letters and it outputs the correct number, especially because seemingly no one on FreeCodeCamp has managed to solve it in this manner yet. I'm still convinced that there is a way but I've to put it back for the sake of my actual goal, learning to code.

My plans for the next days:
  • Work through the remaining "Advanced Algorithm Scripting" challenges
  • Finish chapter 9 on Regular Expression (including exercises; 'Eloquent JavaScript')
  • Gradually upload my work on GitHub

Follow me on GitHub

Follow me on FreeCodeCamp

Follow my Pens on Codepen