Skip to content

epyifany/leetcode-practices

Repository files navigation

leetcode-practices

Jan 1, 2020

  1. Two Sum/
  • Recurse twice --> O(n^2)
  • Could use a Hash Map for better complexity--> O(n)
  1. Reverse Linked List/
  • Spacial & Temporal Complexity
  • Adding a Prev pointer to save "space": Spcial O(1) vs O(n)
  1. Valid Permutations for DI Sequence/
  • Using python @lru_cache(None)
  • using dynamic programming to avoid repeated work

Jan 6, 2020

  1. Merge Two Sorted Lists /
  • Could implement using recursion
  • Could also have O(1) complexity by using pointers

Jan 7, 2020

Similar practices

  1. Fibonacci Number
  2. Climbing Stairs
  3. Valid Parentheses
  4. Happy Number/

Jan 20, 2020

  1. Surface Area of 3D Shapes:
  • Reading the question: be more patient and plug in variables
  • parenthesis on pointers while incrementing , debugging by segments
  • Using comments smartly
  • Using auto keyword/ptrs, vector indexes, syntactic sugar in cpp.
  • Problem of 3D shapes: use (sum - touching) rather than six sides(hidden surfaces)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published