Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🚀 🐘 🌈 LeetCode with PHP 🔥

License

NotificationsYou must be signed in to change notification settings

imajinyun/leetcode-php

Repository files navigation

Build StatusBuild statusBuildcodecovStyleCIQuality Gate StatusScrutinizer Code QualityFOSSA StatusVersionFOSSA Status

Requirements

  • PHP >= 8.0
  • PHPUnit >= 9.5

Usage

Install the package throughComposer.

Run the Composer require command from the Terminal:

$ git clone git@github.com:imajinyun/leetcode-php.git$cd leetcode-php&& composer install $ phpunit -vvv

Contents

LeetCode

Array
SubjectSourceSolution
0001. 两数之和Two SumSolution
0118. 杨辉三角Pascal's TriangleSolution
0026. 删除有序数组中的重复项Remove Duplicates from Sorted ArraySolution
0027. 移除元素Remove ElementSolution
0053. 最大子序和Maximum SubarraySolution
0054. 螺旋矩阵Spiral MatrixSolution
0059. 螺旋矩阵 IISpiral Matrix IISolution
0066. 加一Plus OneSolution
0088. 合并两个有序数组Merge Sorted ArraySolution
0118. 杨辉三角Pascal's TriangleSolution
0119. 杨辉三角 IIPascal's Triangle IISolution
0163. 缺失的区间Missing RangesSolution
0167. 两数之和 II - 输入有序数组Two Sum II - Input array is sorted
0169. 多数元素Majority ElementSolution
0189. 旋转数组Rotate ArraySolution
0215. 数组中的第 K 个最大元素Kth Largest Element in an ArraySolution
0217. 存在重复元素Contains DuplicateSolution
0219. 存在重复元素 IIContains Duplicate IISolution
0228. 汇总区间Summary Ranges
0238.Product of Array Except SelfSolution
0243. 最短单词距离Shortest Word Distance
0268. 丢失的数字Missing Number
0283. 移动零Move ZeroesSolution
0350. 两个数组的交集 IIIntersection of Two Arrays IISolution
0384. 打乱数组Shuffle an ArraySolution
0414. 第三大的数Third Maximum Number
0448. 找到所有数组中消失的数字Find All Numbers Disappeared in an Array
0485. 最大连续 1 的个数Max Consecutive OnesSolution
0509. 斐波那契数Fibonacci NumberSolution
0561. 数组拆分 IArray Partition ISolution
0566. 重塑矩阵Reshape the MatrixSolution
0605. 种花问题Can Place FlowersSolution
0628. 三个数的最大乘积Maximum Product of Three Numbers
0643. 子数组最大平均数 IMaximum Average Subarray I
0661. 图片平滑器Image SmootherSolution
0674. 最长连续递增序列Longest Continuous Increasing SubsequenceSolution
0697. 数组的度Degree of an ArraySolution
0717. 1 比特与 2 比特字符1-bit and 2-bit CharactersSolution
0724. 寻找数组的中心下标Find Pivot IndexSolution
0746. 使用最小花费爬楼梯Min Cost Climbing StairsSolution
0747. 至少是其他数字两倍的最大数Largest Number At Least Twice of OthersSolution
0766. 托普利茨矩阵Toeplitz MatrixSolution
0830. 较大分组的位置Positions of Large GroupsSolution
0832. 翻转图像Flipping an ImageSolution
0867. 转置矩阵Transpose MatrixSolution
0888. 公平的糖果棒交换Fair Candy SwapSolution
0896. 单调数列Monotonic ArraySolution
0905. 按奇偶排序数组Sort Array By ParitySolution
0914. 卡牌分组X of a Kind in a Deck of CardsSolution
0922. 按奇偶排序数组 IISort Array By Parity IISolution
0941. 有效的山脉数组Valid Mountain ArraySolution
0977. 有序数组的平方Squares of a Sorted ArraySolution
0985. 查询后的偶数和Sum of Even Numbers After QueriesSolution
0989. 数组形式的整数加法Add to Array-Form of IntegerSolution
0999. 可以被一步捕获的棋子数Available Captures for RookSolution
1002. 查找常用字符Find Common CharactersSolution
1013. 将数组分成和相等的三个部分Partition Array Into Three Parts With Equal SumSolution
1018. 可被 5 整除的二进制前缀Binary Prefix Divisible By 5Solution
1051. 高度检查器Height CheckerSolution
1064. 不动点Fixed PointSolution
1085. 最小元素各数位之和Sum of Digits in the Minimum NumberSolution
1086. 前五科的均分High FiveSolution
1089. 复写零Duplicate ZerosSolution
1099 小于 K 的两数之和Two Sum Less Than KSolution
1122. 数组的相对排序Relative Sort ArraySolution
1128. 等价多米诺骨牌对的数量Number of Equivalent Domino PairsSolution
1150. 检查一个数是否在数组中占绝大多数Check If a Number Is Majority Element in a Sorted ArraySolution
1160. 拼写单词Find Words That Can Be Formed by CharactersSolution
1176. 健身计划评估Diet Plan Performance EasySolution
1184. 公交站间的距离Distance Between Bus StopsSolution
1185. 一周中的第几天Day of the WeekSolution
1200. 最小绝对差Minimum Absolute DifferenceSolution
1217. 玩筹码Minimum Cost to Move Chips to The Same PositionSolution
1232. 缀点成线Check If It Is a Straight LineSolution
1243. 数组变换Array TransformationSolution
1252. 奇数值单元格的数目Cells with Odd Values in a MatrixSolution
1260. 二维网格迁移Shift 2D GridSolution
1266. 访问所有点的最小时间Minimum Time Visiting All PointsSolution
1275.Find Winner on a Tic Tac Toe GameSolution
1295. 统计位数为偶数的数字Find Numbers with Even Number of DigitsSolution
HashTable
SubjectSourceSolution
0001. 两数之和Two SumSolution
0012. 整数转罗马数字Integer to RomanSolution
0013. 罗马数字转整数Roman to IntegerSolution
0136. 只出现一次的数字Single NumberSolution
0202. 快乐数Happy NumberSolution
0242. 有效的字母异位词Valid AnagramSolution
0349. 两个数组的交集Intersection of Two ArraysSolution
0387. 字符串中的第一个唯一字符First Unique Character in a StringSolution
0454. 四数相加 II4Sum IISolution
Linked List
SubjectSourceSolution
0002. 两数相加Add Two NumbersSolution
0021. 合并两个有序链表Merge Two Sorted ListsSolution
0024. 两两交换链表中的节点Swap Nodes in PairsSolution
0092. 反转链表 IIReverse Linked List IISolution
0203. 移除链表元素Remove Linked List ElementsSolution
0206. 反转链表Reverse Linked ListSolution
0141. 环形链表Linked List CycleSolution
0234. 回文链表Palindrome Linked ListSolution
0237. 删除链表中的节点Delete Node in a Linked ListSolution
0707. 设计链表Design Linked ListSolution
Math
SubjectSourceSolution
0013. 罗马数字转整数Roman to IntegerSolution
0050. 计算 x 的 n 次幂Pow(x, n)Solution
0066. 加一Plus OneSolution
0069. X 的平方根Sqrt(x)Solution
0150. 逆波兰表达式求值Evaluate Reverse Polish NotationSolution
0171. Excel 表列序号Excel Sheet Column NumberSolution
0227. 基本计算器 IIBasic Calculator IISolution
1118. 一月有多少天Number of Days in a MonthSolution
Two Pointers
SubjectSourceSolution
0015. 三数之和3SumSolution
0016. 最接近的三数之和3Sum ClosestSolution
0018. 四数之和4SumSolution
0019. 删除链表的倒数第 N 个节点Remove Nth Node From End of ListSolution
0142. 环形链表 IILinked List Cycle IISolution
0209. 长度最小的子数组Minimum Size Subarray SumSolution
0287. 寻找重复数Find the Duplicate NumberSolution
0844. 比较含退格的字符串Backspace String CompareSolution
0997. 有序数组的平方Squares of a Sorted ArraySolution
String
SubjectSourceSolution
0003. 无重复字符的最长子串Longest Substring Without Repeating CharactersSolution
0005. 最长回文子串Longest Palindromic SubstringSolution
0006. Z 字形变换Zigzag ConversionSolution
0008. 字符串转换整数 (atoi)String to Integer (atoi)Solution
0125. 验证回文串Valid PalindromeSolution
0179. 最大数Largest NumberSoluton
0344. 反转字符串Reverse StringSolution
0409. 最长回文串Longest PalindromeSolution
0541. 反转字符串 IIReverse String IISolution
Binary Search
SubjectSourceSolution
0035. 搜索插入位置Search Insert PositionSolution
0069. x 的平方根Sqrt(x)Solution
0162. 寻找峰值Find Peak ElementSolution
0367. 有效的完全平方数Valid Perfect SquareSolution
0704. 二分查找Binary SearchSolution
Divide and Conquer
SubjectSourceSolution
0169. 多数元素Majority ElementSolution
Dynamic Programming
SubjectSourceSolution
0005. 最长回文子串Longest Palindromic SubstringSolution
0062. 不同路径Unique PathsSolution
0063. 不同路径 IIUnique Paths IISolution
0064. 最小路径和Minimum Path SumSolution
0070. 爬楼梯Climbing StairsSolution
0072. 编辑距离Edit Distance
0120. 三角形最小路径和TriangleSolution
0121. 买卖股票的最佳时机Best Time to Buy and Sell StockSolution
0122. 买卖股票的最佳时机 IIBest Time to Buy and Sell Stock IISolution
0123. 买卖股票的最佳时机 IIIBest Time to Buy and Sell Stock IIISolution
0128. 最长连续序列Longest Consecutive Sequence
0152. 乘积最大子数组Maximum Product SubarraySolution
0188. 买卖股票的最佳时机 IVBest Time to Buy and Sell Stock IVSolution
0213. 打家劫舍 IIHouse Robber IISolution
0300. 最长上升子序列Longest Increasing Subsequence
0322. 零钱兑换Coin Change
0309. 佳买卖股票时机含冷冻期Best Time to Buy and Sell Stock with CooldownSolution
0673. 最长递增子序列的个数Number of Longest Increasing Subsequence
0674. 最长连续递增序列Longest Continuous Increasing Subsequence
0714. 买卖股票的最佳时机含手续费Best Time to Buy and Sell Stock with Transaction FeeSolution
1143. 最长公共子序列Longest Common Subsequence
1289. 下降路径最小和 IIMinimum Falling Path Sum IISolution
1397. 找到所有好字符串Find All Good Strings
Backtracking
SubjectSourceSolution
0036. 有效的数独Valid SudokuSolution
0037. 解数独Sudoku Solver
0039. 组合总和Combination Sum
0040. 组合总和 IICombination Sum II
0046. 全排列Permutations
0047. 全排列 IIPermutations II
0051. N 皇后N-Queens
0052. N 皇后 IIN-Queens II
0078. 子集Subsets
0079. 单词搜索Word SearchSolution
0090. 子集 IISubsets II
Stack
SubjectSourceSolution
0020. 有效的括号Valid ParenthesesSolution
0094. 二叉树的中序遍历Binary Tree Inorder TraversalSolution
0496. 下一个更大元素 INext Greater Element ISolution
0503. 下一个更大元素 IINext Greater Element IISolution
0739. 每日温度Daily TemperaturesSolution
Greedy
Sort
Bit Manipulation
SubjectSourceSolution
0029. 两数相除Divide Two IntegersSolution
0190. 颠倒二进制位Reverse BitsSolution
0191. 位 1 的个数Number of 1 BitsSolution
0231. 2 的幂Power of TwoSolution
0338. 比特位计数Counting BitsSolution
0461. 汉明距离Hamming DistanceSolution
Tree
SubjectSourceSolution
0020. 括号生成Generate ParenthesesSolution
0098. 验证二叉搜索树Validate Binary Search TreeSolution
0100. 相同的树Same TreeSolution
0102. 二叉树的层序遍历Binary Tree Level Order TraversalSolution
0103. 二叉树的锯齿形层次遍历Binary Tree Zigzag Level Order TraversalSolution
0104. 二叉树的最大深度Maximum Depth of Binary TreeSolution
0199. 二叉树的右视图Binary Tree Right Side ViewSolution
0230. 二叉搜索树中第 K 小的元素Kth Smallest Element in a BSTSolution
0235. 二叉搜索树的最近公共祖先Lowest Common Ancestor of a Binary Search TreeSolution
0236. 二叉树的最近公共祖先Lowest Common Ancestor of a Binary TreeSolution
0450. 删除二叉搜索树中的节点Delete Node in a Binary Search TreeSolution
0515. 在每个树行中找最大值Find Largest Value in Each Tree RowSolution
0637. 二叉树的层平均值Average of Levels in Binary TreeSolution
0700. 二叉搜索树中的搜索Search in a Binary Search TreeSolution
0701. 二叉搜索树中的插入操作Insert into a Binary Search TreeSolution
0993. 二叉树的堂兄弟节点Cousins in Binary TreeSolution
Depth-First Search
Breadth-First Search
Union Find
SubjectSourceSolution
0200. 岛屿数量Number of IslandsSolution
Graph
SubjectSourceSolution
Design
SubjectSourceSolution
0208. 实现 Trie(前缀树)Implement Trie (Prefix Tree)Solution
0225. 用队列实现栈Implement Stack using QueuesSolution
0232. 用栈实现队列Implement Queue using StacksSolution
Topological Sort
SubjectSourceSolution
Trie
SubjectSourceSolution
Binary Indexed Tree
SubjectSourceSolution
Segment Tree
SubjectSourceSolution
Binary Search Tree
SubjectSourceSolution
0278. 第一个错误的版本First Bad VersionSolution
Recursion
SubjectSourceSolution
0509. 斐波那契数Fibonacci NumberSolution
Brainteaser
SubjectSourceSolution
Memoization
SubjectSourceSolution
Queue
SubjectSourceSolution
0239. 滑动窗口最大值Sliding Window MaximumSolution
Reservoir Sampling
SubjectSourceSolution
Ordered Map
SubjectSourceSolution
Geometry
SubjectSourceSolution
Rejection Sampling
SubjectSourceSolution
Sliding Window
SubjectSourceSolution
0003. 无重复字符的最长子串Longest Substring Without Repeating CharactersSolution
0076. 最小覆盖子串Minimum Window SubstringSolution
0438. 找到字符串中所有字母异位词Find All Anagrams in a StringSolution
0567. 字符串的排列Permutation in StringSolution
Line Sweep
SubjectSourceSolution
Rolling Hash
SubjectSourceSolution
Suffix Array
SubjectSourceSolution
Database
SubjectSourceSolution
Shell
SubjectSourceSolution
Concurrency
SubjectSourceSolution
Sorting
SubjectSourceSolution
Heap (Priority Queue)
SubjectSourceSolution
0295. 数据流的中位数Find Median from Data StreamSolution
0347. 前 K 个高频元素Top K Frequent ElementsSolution
0378. 有序矩阵中第 K 小的元素Kth Smallest Element in a Sorted MatrixSolution
0703. 数据流中的第 K 大元素Kth Largest Element in a StreamSolution
Merge Sort
SubjectSourceSolution
String Matching
SubjectSourceSolution
Matrix
SubjectSourceSolution
Monotonic Stack
SubjectSourceSolution
Simulation
SubjectSourceSolution
Combinatorics
SubjectSourceSolution
Binary Tree
SubjectSourceSolution
0101. 对称二叉树Symmetric TreeSolution
0124. 二叉树最大路径和Binary Tree Maximum Path SumSolution
0226. 翻转二叉树Invert Binary TreeSolution
Doubly-Linked List
SubjectSourceSolution
Interactive
SubjectSourceSolution
Bucket Sort
SubjectSourceSolution
Radix Sort
SubjectSourceSolution
Counting
SubjectSourceSolution
Data Stream
SubjectSourceSolution
Iterator
SubjectSourceSolution
Hash Function
SubjectSourceSolution
Enumeration
SubjectSourceSolution
Number Theory
SubjectSourceSolution
Prefix Sum
SubjectSourceSolution
Quickselect
SubjectSourceSolution
Ordered Set
SubjectSourceSolution
Monotonic Queue
SubjectSourceSolution
Counting Sort
SubjectSourceSolution
Game Theory
SubjectSourceSolution
Eulerian Circuit
SubjectSourceSolution
Randomized
SubjectSourceSolution
Shortest Path
SubjectSourceSolution
Bitmask
SubjectSourceSolution
Probability and Statistics
SubjectSourceSolution
Minimum Spanning Tree
SubjectSourceSolution
Biconnected Component
SubjectSourceSolution
Strongly Connected Component
SubjectSourceSolution

剑指 Offer

程序员面试金典

License

FOSSA Status

About

🚀 🐘 🌈 LeetCode with PHP 🔥

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp