Leetcode in itself isn't very useful. Yes, take 30 minutes to solve a Data Structures & Algorithm (DSA) question in an interview, but over the past 6 months in actual work, I've hardly had the need for DSA.
However, the mathematical thinking behind it may be very useful! Recently my feature's lead was ill, and I stepped up to fill that role. Swimming around in complexity and edge cases, and suddenly all those months of Leetcode practice just clicked!
1. Problem-Solving Skills
This is a process of a typical Leetcode interview
- R - Repeat the question to make sure you understood problem.
- E - give Examples to make even more sure.
- A - suggest Algorithm(s) that might work.
- C - Code it up, after permission from interviewer.
- T - Test your code, run a few test cases.
- O - Optimize the time / space complexity.
Credits: https://www.youtube.com/watch?v=DIR_rxusO8Q (omg, I viewed this prior to my first coding interview in May 2021)
And this is how I solved the problem at work
- R - Revise problem information and constraints
- E - think of Example test cases
- A - find Areas in the codebase where I could implement new feature effectively, consider maintainability etc.
- C - Code it up
- T - Test it (with an XCode Simulator)
- O - Optimize (in terms of writing Clean Code for maintainability. Time complexity is less important here in Frontend)
It is pretty much the same process!
2. It's OK to Simplify the Problem
Some days your mind is just sleeping, and in Leetcode you just can't solve. But you can solve a simpler sub-problem, rest, then come up with a better solution another time! (Though the interviewer might be like the GIF above)
Same goes for work, sometimes you can only deliver a partial feature (but your users won't know that) and that's OK! It can be built up slowly.
Just make sure to communicate the challenges and get everyone onboard.
3. Copy-Paste
Don't need to re-invent the wheel. If a problem you're trying to solve has been solved before, just copy-paste (but take care to check that code works / is safe).
4. DETERMINATION
Challenging problems are tough to crack, but with determination and focus, we will eventually get through it :)
(though Curiosity really helped me see it through also hmm)
Top comments (0)