Member-only story
Algorithms in JavaScript
40 Problems, Solutions, and Explanations
When you use my referral link above 👆 to become a Medium member, all proceeds will be donated towards the construction of the Silicon Wat Campus for children in Ukraine and Cambodia ❤️
Introduction
The interview process usually begins with an initial phone screen and then an all-day on-site that check for coding skills and cultural fit. Almost without exception, the deciding factor is coding aptitude. After all, engineers are paid to deliver working software at the end of the day. Traditionally, whiteboarding is used to test for this aptitude. More than getting the answer right is the thought process clearly articulated. In code as in life, the right answer is not always clear, but good reasoning is usually good enough. The ability to reason effectively signals the potential to learn, adapt, and evolve. The best engineers are always growing, and the best companies are always innovating.
Algorithm challenges are effective because there are more than one way to solve them. This opens the possibility for decisions to be made and the calculus of those decisions. When solving an algorithm problem, we should challenge ourselves to look at the problem definition from multiple perspectives, then weigh the benefits and demerits of various approaches. With enough practice, we might even glimpse a universal truth: there’s no “perfect” solution.
To truly master Algorithms is to understand them in relationship to Data Structures. Data structures and algorithms go hand-in-hand like Yin and Yang, the glass and the water. Without the glass, water cannot be contained. Without data structures, we have no objects by which to apply logic. Without water, the glass is empty and devoid of sustenance. Without algorithms, objects cannot be transformed or “consumed”.
For a quick high-level analysis of Data Structures in JavaScript: