Where Do I Start With Algorithms?
“I am having a really hard time with basic algorithms right now. I don’t think I really understand them. Is this common for some of you? Is that okay? Is there something I should do to help myself? I would appreciate any input. Thank you!”
Right now, every problem feels completely different …because it totally is! Learning how to read, comprehend, & solve algorithm challenges is almost its own language. Eventually, it becomes more of a pattern-matching exercise: “Hey, I’ve already seen this problem before! Today, it’s just wearing a fancier hat & a new pair of shoes.”
Until you understand what a problem is asking for, just figuring out how to properly handle the inputs & outputs is its own challenge. Your solutions may grow complex, but let’s appreciate how simple these challenges are in concept. Every algorithm challenge ever follows the exact same format:
- extract the inputs
- have some fun transforming that data
- export the outputs
I certainly remember over-complicating the first ~10 problems I ever approached. They were only difficult because I didn’t understand precisely how they were:
- trying to feed me the inputs
- expecting me to display my results (especially since they wanted me to handle multiple test cases).
I don’t care if the challenge is to “add two numbers”: if you’re new to coding, storing a variable number of inputs to modify is not a trivial matter.
Most people bite off way way more than they can chew at first. I encourage you to think about solving algorithm challenges like lifting weights. Don’t expect to do any heavy lifts until you’ve put in the lighter repetitions. Not everyone needs to explore lifting heavy or studying advanced algorithms, but if you decide you want to become stronger:
- Sign up on HackerRank (or LeetCode, although HackerRank has more “Day 1” stuff)
- Navigate to their “Algorithms” section
- Solve the absolute first, most basic warm-up question
- Approach the next, incremental challenge
- And another one…
This will introduce you to their text editor/environment, allow you to choose your language of choice, and begin building your confidence by dozens of small wins week after week. The best part about this for beginners is building your first base of competency. Confidence doesn’t come from being great at everything as much as feeling ownership over one specific thing, no matter how small.
Pro-tip: some challenges provide “boilerplate code” that handles the inputs and outputs before you’ve even touched the problem. I encourage you to completely wipe these crutches after your first few problems. From here on out, this is an awesome exercise for getting comfortable with different corners of your language, especially “handling I/O” (input & output).
The sooner you feel comfortable saying “I’m pretty comfortable with language X. Actually, I’m quite good at it…” the sooner you’ll really start identifying as a developer. You never needed anyone’s permission to identify as one, but this will help if you prefer more proof. That identity-level shift is what makes all the difference so do everything you can to lower that barrier-to-entry, whatever that means for you.