Skip to content

hassannajj/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

  1. If input array is sorted then - Binary search OR Two pointers / sliding window

  2. If asked for all permutations/subsets then - Backtracking

  3. If given a tree then - DFS - BFS

  4. If given a graph then - DFS - BFS

  5. If given a linked list then - Two pointers

  6. If recursion is banned then - Stack

  7. If must solve in-place then - Swap corresponding values - Store one or more different values in the same pointer

  8. If asked for maximum/minimum subarray/subset/options then - Dynamic programming

  9. If asked for top/least K items then - Heap - QuickSelect

  10. If asked for common strings then - Map - Trie

  11. Else - Map/Set for O(1) time & O(n) space

  12. Sort input for O(nlogn) time and O(1) space

About

Leetcode Problems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages