changandao / leetcode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Notes

LEETCODES TAGS

array

832 Flipping an Image

905 Sort Array By Parity

561 Array Partition I

896 Monotonic Array

Matrix problems

867 Transpose Matrix

push_back is faster than = in vector!

566 Reshape the Matrix

766 Toeplitz Matrix

283 Move Zeroes

Interview problem

238 Product of Array Except Self

设置头尾两个指针

169 Majority Element

int majorityElement(vector<int>& nums) {
    int c=1;
    int n=nums[0];
    int i;
    for(i=1;i<nums.size();i++)
    {
        if(nums[i]==n)
            c++;
        else
            c--;
        if(c==0)
        {
            c=1;
            n=nums[i];
        }
    }
    return n;
}

Majority Voting Algorithm Moore voting

linkedlist

206 Reverse Linked List

tree

105. Construct Binary Tree from Preorder and Inorder Traversal

string

math

search

240. Search a 2D Matrix II

Fast ai

Make functions if you use something often. Jeremy made function called stats(x) which returned the mean and the standard deviation of the input.

Talking and reading is cheap, show me the code.

One thing I noticed right away was that Jeremy didn’t just read things from somewhere but he tested those by himself.

About


Languages

Language:C++ 78.6%Language:CMake 8.8%Language:C 8.6%Language:Makefile 4.1%