Skip to content

InterviewBit data structure and algorithms problem solultions

Notifications You must be signed in to change notification settings

ckvermaAI/Data-structures-and-algorithms

Repository files navigation

Tips for solving DSA questions

General Tips

  1. Listen carefully -> Lookout for every detail mentioned in the question -> are you using all the relevant details that are mentioned in the problem definition

  2. Draw an example -> But be careful, you should use a example which is general to the problem -> Not a special case -> sufficient large example "not very small"

  3. State a brute force solution -> once you have the example, immediately come up with a Brute Force solution

  4. optimize your solution -> Look for any unused infomation (which is mentioned in the problem definition ) -> Use a fresh example ( that will help you to see the problem from different prespective ) -> solve it "incorrectly" ( like having brute force solution will help to find the optimize one similarly having the incorrect/partially correct solution will help to find the right solution ) -> make time vs. space trade off -> precompute information -> use a hash table -> Think about best conceivable time

  5. Implement

  6. Test

Optimization Techniques

  1. Look for BUD ( BottleNecks, Unneccessary work, Duplicated work )
  2. Do it Yourself ( Grab a pen and paper, and find out the solution for the problem )
  3. Simplify and Generalize
  4. Base case and build
  5. Data Structure Brainstrom
  6. Best conceivable runtime (BCR) -> tells you about the best acheivable time complexity -> also tells you about that we are done optimizing the time complexity and we can play with the space complexity of our solution

Reference: Cracking the coding interview by Gayle Laakmann Mcdowell

About

InterviewBit data structure and algorithms problem solultions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published