On AlgoExpert, there is a question, ‘Tournament Winner’. Usually, after completing a question, I like to check my sollution against the main sollution. Typically, my sollution is somewhat similar in logic, maybe not as optimal but close. However, my answer was completely different but not exactly less optimal.
Most of my coding has been in ruby, but recently I have been working more with javascript. With that, working with arrays are slightly different in order to achieve the same goal.
Woah! I think I stumbled upon something. I was working with my portfolio and setting up a grid display, getting slightly frustrated. Setting up a 2x2 grid worked easily as I described in my previous post. However, I wanted to get weird and try a 9x9 grid. I set up everything similar to a YouTube tutorial, but everything was going to the top left of the page.
Getting code to work and be functional is its own challenge. After getting everything working and styled, similar to realestate, one must think “location, location, location”. Design is a challenging part for many developers and is often overlooked. Thus, a few of us are guilty of ignoring some CSS techniques. The grid is a simple way to start the placement of divs.
Recently, I have been practicing some algorithms in Javascript. Previously, I did algorithm questions in ruby; so, now I have to reorient the way I can use methods and iterations. Within ruby, using an if statement within a .each method is pretty straightforward. However, in javascript, it is a bit complicated. According to Michael Lehenbauer on StackOverflow, “your forEach callback can return true to cancel enumeration and forEach() will return true to signal that enumeration was canceled.” With that, we have to switch up the logic a bit. I found that using “for” loops works will.