Skip to content

Katherinaxxx/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

category

other hot keywords:Palindrome(mic), Subsequence

Array

    1. 螺旋矩阵Spiral Matrix 顺时针打印矩阵
    1. Next Permutation
    1. Product of Array Except Self
  • 189.rotate-array
  • 283.move-zero
    1. Range Sum Query - Immutables
  • 66.Plus One
  • 快手-跳格子
    1. Intersection of Two Arrays
  • 17.10. Find Majority Element LCCI
    1. Game of Life
    1. Find All Numbers Disappeared in an Array
    1. Shortest Unsorted Continuous Subarray
    1. Rotate Image
    1. 宝石与石头Jewels and Stones
    1. Kids With the Greatest Number of Candies
  • 美团2019路由器接收信号
  • LCOF03. 数组中重复的数字
  • 154 LCOF11 旋转数组的最小数字
    1. 第 N 个泰波那契数
  • 剑指 Offer 58 - II. 左旋转字符串
  • 剑指 Offer 22. 链表中倒数第k个节点
    1. 找到需要补充粉笔的学生编号
    1. 提莫攻击
    1. 打乱数组
  • 剑指 Offer 61. 扑克牌中的顺子

HashMap

  • 1.two-sum 两数之和
    1. First Missing Positive
    1. 4Sum II
  • 242.valid-anagram
  • 49.group-anagrams
  • 36.Valid Sudoku
  • 无重复字符最长子串
    1. Longest Consecutive Sequence
    1. Contains Duplicate
  • 剑指 Offer 50. 第一个只出现一次的字符
    1. 回旋镖的数量
    1. 相对名次

前缀和

"连续子数组""差分数组"

    1. Subarray Sums Divisible by K
    1. Subarray Sum Equals K (前缀+hashmap)
    1. Count Number of Nice Subarrays
    1. 矩形区域不超过 K 的最大数值和 (困难!没懂透!)
    1. 连续的子数组和
    1. 连续数组
    1. 航班预订统计【区间求和】

左右边界 中间收敛 (夹逼)双指针 滑窗

滑动窗口leetcode思路题解总结的很好:step1找到可行解step2优化可行解 powcai大腿的模版 "连续子数组"

  • 3.3sum
  • 11.container-with-most-water
    1. 三数之和
    1. 3Sum Closest
  • 26.remove-duplicates-from-sorted-array
    1. Longest Substring Without Repeating Characters最长不含重复字符的子字符串
    1. Minimum Window Substring
    1. 长按键入
    1. Minimum Size Subarray Sum
    1. Is Subsequence
    1. Find All Anagrams in a String
    1. Permutation in String
  • 最长全1串
    1. 移除元素removeElement
  • 剑指 Offer 18. 删除链表的节点
  • 剑指 Offer 21. 调整数组顺序使奇数位于偶数前面
  • 剑指 Offer 57. 和为s的两个数字
    1. 有效三角形的个数
    1. 比较版本号
    1. 有序数组的平方
    1. 两数之和 II - 输入有序数组

Fibonacci

  • 70.climbing-stairs
  • LCOF10斐波那契数列
  • 509.LCOF青蛙跳台阶问题

二分

  • 剑指 Offer 53 - I. 在排序数组中查找数字 I
  • 剑指 Offer 53 - II. 0~n-1中缺失的数字
    1. 寻找峰值

Linked List

    1. 两数相加
  • 21.Merge Two Sorted Lists合并排序链表 [hot]
    1. Merge k Sorted Lists
    1. 旋转链表Rotate List
    1. Copy List with Random Pointer
  • 141.linked list cycle (有无环,套路快慢指针)
    1. Linked List Cycle II (floyd找出环起点)
  • 146.LRU Cache
  • LCOF24 206.Reverse Linked List [hot]
    1. Reverse Linked List II
  • Add Two Numbers
    1. Intersection of Two Linked Lists 相交链表(相交部分是一样的 遍历完了交换 最多两次遍历短链表即可找到相交段)
    1. Reorder List重排链表 (取中电、反转、交叉合并)
    1. 反转链表(prev、cur、next)
    1. Palindrome Linked List
    1. Delete Node in a Linked List 删除链表中的节点(val和next替换成下一个的val和next)
    1. Odd Even Linked List
    1. Split Linked List in Parts
  • 面试题 02.01. 移除重复节点
  • LCOF22. 链表中倒数第k个节点
  • 剑指 Offer 52. 两个链表的第一个公共节点
    1. 链表的中间结点

Stack

"第几个最大/下一个最大""括号"

  • 20.valid-parentheses
    1. Longest Valid Parentheses (括号匹配)
  • 155.min-stack
  • 84.largest-rectangle-in-histogram 柱状图中最大的矩形 (美团2017)
    1. Maximal Rectangle
  • 42.trapping-rain-water
  • LCOF9用两个栈实现队列 [hot]
    1. 基本计算器 II (实现字符串加减乘除,用栈储存数字,根据符号类型入栈)
    1. Decode String
    1. Next Greater Element I
    1. Max Chunks To Make Sorted II最多能完成排序的块 II
    1. Daily Temperatures
  • 字节2020秋招左右侧第一个最大元素下标
  • LCOF6. 从尾到头打印链表
    1. 股票的最大利润
    1. 反转每对括号间的子串
  • 剑指 Offer 30. 包含min函数的栈
  • 剑指 Offer 31. 栈的压入、弹出序列
    1. 下一个更大元素 II

Deque

  • 239.sliding-window-maximum
  • 641.design-circular-deque
  • LCOF剑指 Offer 37. 序列化二叉树
  • 剑指 Offer 59 - II. 队列的最大值
  • 剑指 Offer 32 - II. 从上到下打印二叉树 II

Tree or Recursion or backtrace or iteration

    1. Remove Nth Node From End of List
    1. Pow(x, n)
    1. Flatten Binary Tree to Linked List
    1. Combination Sum
    1. Subsets
    1. Validate Binary Search Tree
  • 94.binary-tree-inorder-traversal [hot]
    1. Binary Tree Maximum Path Sum
  • 538/1038. Convert BST to Greater Tree
  • 144.binary-tree-preorder-transversal
  • 37.Sudoku Solver
  • 22.generate-parentheses
  • 46.permutations(无重复数)
  • 47.Permutations II (有重复数)
  • 17.letter-combinations-of-a-phone-number
    1. 相同的树
  • 105.Construct Binary Tree from Preorder and Inorder Traversal
  • 106.Construct Binary Tree from Inorder and Postorder Traversal
    1. Convert Sorted Array to Binary Search Tree 将有序数组转换为二叉搜索树 (以中间点作为根 左右分别递归有序数组转二叉树)
    1. Balanced Binary Tree平衡二叉树
    1. Invert Binary Tree
    1. Lowest Common Ancestor of a Binary Search Tree二叉搜索树的最近公共祖先
  • 111.Minimum Depth of Binary Tree
    1. Symmetric Tree
  • 77.combinations
  • 104.Maximum Depth of Binary Tree
    1. Serialize and Deserialize Binary Tree
    1. Longest Substring with At Least K Repeating Characters
  • 617.Merge Two Binary Trees
  • 236.lowest-common-ancestor-of-a-binary-tree
  • 590.N-ary Tree Postorder Traversal
  • 589.N-ary Tree Preorder Traversal
  • 429.N-ary Tree Level Order Traversal
    1. Path Sum III
  • 快手-运动会
    1. Subtree of Another Tree
    1. Palindrome Partitioning
  • LCOF重建二叉树通过前中还原树
  • LCOF62. 圆圈中最后剩下的数字
  • 剑指 Offer 27. 二叉树的镜像
  • 剑指 Offer 28. 对称的二叉树
    1. 粉刷房子 III
    1. 叶子相似的树
    1. 移除链表元素
  • 剑指 Offer 55 - I. 二叉树的深度
    1. 优美的排列
  • 剑指 Offer 54. 二叉搜索树的第k大节点
    1. 3的幂
  • 剑指 Offer 36. 二叉搜索树与双向链表
  • 剑指 Offer 55 - II. 平衡二叉树
    1. 二叉搜索树中的搜索
  • 剑指 Offer 68 - I. 二叉搜索树的最近公共祖先
  • 剑指 Offer 68 - II. 二叉树的最近公共祖先
  • 剑指 Offer 33. 二叉搜索树的后序遍历序列
  • 剑指 Offer 34. 二叉树中和为某一值的路径
  • 剑指 Offer 32 - III. 从上到下打印二叉树 III

DFS\BFS\backtrace

  • 51.N queens
    1. Word Search
  • 102.Binary Tree Level Order Traversal
    1. Binary Tree Zigzag Level Order Traversal
    1. Diameter of Binary Tree
  • 127.Word Ladder.py
    1. Remove Invalid Parentheses
  • 1091.Shortest Path in Binary Matrix
  • 滴滴2018岛屿
  • LCOF12. 矩阵中的路径
    1. 停在原地的方案数
    1. 二叉树的堂兄弟节点
  • 剑指 Offer 26. 树的子结构
    1. 所有可能的路径
  • 剑指 Offer 35. 复杂链表的复制
    1. 图像渲染
    1. 岛屿的最大面积
    1. 边框着色

DP动态规划 / 背包问题 / 状态机

背包问题 dp[x]表示容量为x的背包最多能装多少

  • 5.Longest Palindromic Substring
  • 53.Maximum Subarray
  • 152.Maximum Product Subarray
  • 62.Unique Paths
  • 63.Unique Paths II
  • 64.Minimum Path Sum
  • 72.Edit Distance
  • 91.Decode Ways
    1. Unique Binary Search Trees
    1. Word Break
  • 120.Triangle
    1. Best Time to Buy and Sell Stock
    1. Best Time to Buy and Sell Stock with Cooldown
  • 198.House Robber.py
  • 213.House Robber II
    1. Paint House粉刷房子
  • 面试题 17.16. The Masseuse LCCI
    1. Burst Balloons (变戳气球为加气球)
    1. House Robber III (递归DP)
    1. Maximal Square最大正方形(二维dp[i][j]表示以ij为右下角的正方形的最大变长)
  • 300.Longest Increasing Subsequence
  • 322.Coin Change
    1. Target Sum
    1. Partition Equal Subset Sum
    1. Perfect Squares(类似coin change min遍历可选项)
    1. Palindromic Substrings
    1. Min Cost Climbing Stairs
    1. New 21 Game
    1. Minimum Cost For Tickets
  • 1143.Longest Common Subsequence 最长公共子序列 [hot]
    1. Count Square Submatrices with All Ones(和221思路一致)
  • LCOF46把数字翻译成字符串
  • LCOF47礼物的最大价值
  • 最长公共子串(美团2017)
  • 面试题 08.01. Three Steps Problem LCCI
  • 凑纸币组合(美团2017)
  • 美团2019种花
  • 美团2019时间内考试最高得分
  • 最少完全平方数
  • LCP 19. 秋叶收藏集
    1. 学生出勤记录 II
    1. K 站中转内最便宜的航班
  • 剑指 Offer 19. 正则表达式匹配
  • 剑指 Offer 49. 丑数
  • 剑指 Offer 66. 构建乘积数组

Greedy

    1. Jump Game II
  • 455.Assign Cookies

  • 122.Best Time to Buy and Sell Stock II

  • 55.Jump Game

  • 860.Lemonade Change

  • 874.Walking Robot Simulation

Binary Search O(logN)

  • 33.Search in Rotated Sorted Array

    1. Find First and Last Position of Element in Sorted Array
  • 69.Sqrt(x)

  • 74.Search a 2D Matrix

    1. Search a 2D Matrix II 搜索二维矩阵 II / 剑指 Offer 04. 二维数组中的查找
    1. Find the Duplicate Number
    1. 二分查找
    1. 第一个错误的版本
    1. 搜索插入位置
    1. 搜索二维矩阵

Trie

  • 208.Implement Trie (Prefix Tree)
  • 212.Word Search II

graph图

  • 美团2019遍历图

Disjoint Sets

  • 547.Friend Circles

位运算/二进制

    1. Pow(x, n)
    1. 格雷编码
    1. Single Number 只出现一次的数字(用异或^ 消掉重复的)
    1. Number of 1 Bits
    1. Power of Two
    1. Reverse Bits
    1. Counting Bits
    1. Hamming Distance
    1. Find the Longest Substring Containing Vowels in Even Counts
  • LCOF56数组中数字出现的次数
    1. 解码异或后的数组
    1. 解码异或后的排列
    1. Excel表列名称
    1. 两整数之和
    1. 重复的DNA序列
  • 剑指 Offer 65. 不用加减乘除做加法
  • 剑指 Offer 56 - II. 数组中数字出现的次数 II

string

字符串匹配:KMP、Sunday

    1. Palindrome Number
  • 10.Regular Expression Matching (hard to understand)
    1. Roman to Integer
    1. Longest Common Prefix
    1. Implement strStr() (sunday\kmp\还不会)
    1. 字符串相乘Multiply Strings
    1. Excel Sheet Column Number
    1. Valid Palindrome
  • 344.Reverse String
    1. First Unique Character in a String
    1. Reverse Words in a String III
  • LCOF5. 替换空格
  • 兴业数金2021春招
    1. 分割平衡字符串
    1. 通过删除字母匹配到字典里最长单词
    1. 最大单词长度乘积
    1. 亲密字符串
    1. 从英文中重建数字
    1. 连续字符
  • 剑指 Offer 67. 把字符串转换成整数
  • 面试题 01.01. 判定字符是否唯一
  • 面试题 01.02. 判定是否互为字符重排

    1. Evaluate Division

MATH

    1. Reverse Integer
    1. String to Integer (atoi)正则
    1. Add Digits 各数相加
    1. Happy Number
    1. Count Primes
  • 169.majority-element 多数元素(类似计数的方法)
    1. Missing Number
    1. Nim 游戏 (先手+每次至多抓3个 解法n%4)
    1. Pascal's Triangle
    1. Minimum Factorization最小因式分解
    1. Stone Game(奇葩)
  • equation solution
    1. Divisor Game
  • 面试题64. 求1+2+…+n LCOF
  • 丢骰子(美团2017)
  • 343 LCOF14- I. 剪绳子
  • 剑指 Offer 57 - II. 和为s的连续正数序列
    1. 有效的完全平方数

排序

    1. Sort Colors(计数排序/三指针)
    1. Sort List(归并)
    1. Top K Frequent Elements
    1. Kth Largest Element in an Array
    1. Queue Reconstruction by Height
    1. 用最少数量的箭引爆气球
    1. 距离顺序排列矩阵单元格
    1. 前K个高频单词
  • LCOF40最小的k个数
  • LCOF45把数组排成最小的数
  • 牛牛找工作
  • LCOF51数组中的逆序对
    1. 最接近原点的 K 个点
    1. 救生艇
    1. IPO

SQL

  1. 第二高的薪水

tips & tricks

print("%.6f" % a) # 腾讯笔试因为这个没过 $\Sigma_{i=0}^{n}iC_n^i=n2^{n-1}$

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages