Skip to content

Neverland3124/LeetCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode

My LeetCode Path and C++ language learning

Purpose

  • get familiar with algorithms
  • start with using java but later start to use c++

Focus Topics

  • loops

  • linklist
    • how it different from c as have new
    • nullptr use
    • usually return headNode->next to get rid of the default 0 pointer
  • trees
  • Dynamic Programming
    1. state the subproblem to solve
    2. solving the original problem by subproblems
    3. recursive formula to computer the subproblem
    • 1D array or 2D array both possible
  • vector use
    • string manipulation
    • integer / string change
    • double vector (2D array)
  • integer
    • overflow handle
    • INT_MAX, INT_MIN
    • module and divide
    • palindrome
  • binary search
    • find mid and update low / high
    • try more use <= since = is most time handled seperately in next loop
    • try one some base case like 1/2/3 element as input
    • rotated sorted array have a part of the array sorted
  • divide and conquer
    • calculate some thing about this case
    • then call max/min of three cases (left, this, right)
  • priority queue
    • implemented using a heap to get the min/max
    • default is max, if want min need
    • priority_queue<int, vector, greater> heap;
      • std::priority_queue<int, std::vector, std::greater> heap;
      • push, pop, top

About

My LeetCode Path

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published