Skip to content

Latest commit

 

History

History
14 lines (13 loc) · 1.2 KB

coding-tips.md

File metadata and controls

14 lines (13 loc) · 1.2 KB

coding-tips.md

  • Write the pseudo code first. Never get into coding right away.
  • While you're increasing the value of a pointer variable for an array. Implement the check immediately, don't do any computations after.
  • I'm very slow at debugging mistakes. Having print statemetns and finding the error from there seems inefficient.
  • For two pointers, in each loop only make one step. Do only change (either i++ or j++) at one iteration.
  • Always think clearly before starting to code. Through atleast a couple of different examples.
  • Understand the question clearly before getting excited to answer it.
  • If your algorithm has multiple steps, visualize things after every step.
  • Idea: just solve lots of questions, it's okay if you're copying the answers for now. this will help you be aware of all types of problems. in the second run, you can think about things more closely.
  • Write down principles / claim for each hard question as you solve it. This is how you make progress.
  • Always use a while loop if you're skipping iterations. Use a for loop only if iterations are fixed.
  • Read the question carefully before trying to solve it.
  • If you want to make the code more efficient, start with sorting the array.