欢迎fork and star:Nowcoder-Repository-github 34. Search for a Range 题目 Given an array of integers sorted in asce…
分类:LeetCode
[LeetCode] Simplify Path 简化路径
Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", =&g…
[LeetCode] Restore IP Addresses 复原IP地址
Given a string containing only digits, restore it by returning all possible valid IP address combinatio…
[LeetCode] Number of Boomerangs 回旋镖的数量
Given n points in the plane that are all pairwise distinct, a “boomerang” is a tuple of poi…
LeetCode | Remove Duplicates from Sorted Array II
题目: Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice? For exam…
LeetCode | Unique Binary Search Trees II(构建二叉搜索树)
Given n, generate all structurally unique BST’s (binary search trees) that store values 1…
LeetCode 123. Best Time to Buy and Sell Stock III
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to…
Leetcode PHP题解--D7 905. Sort Array By Parity
905. Sort Array By Parity 题目链接 905. Sort Array By Parity 题目分析 这个题目非常简单。要求把数组重新排序成偶数在前,奇数在后。 思路 把数组拆分成奇偶两组,再拼接即…
缓存策略之LRU和LFU
为什么 缓存,就是把数据存储在本地,简单实用key-value做一个映射就好了。但为什么还要缓存策略,因为缓存的大小需要限制,否则存储的东西只增不减,时间一长就有很多内存浪费。 因为资源总是有限,所以优化,因为优化所以复…
LeetCode刷题之路 到达终点数字
到达终点数字【简单】 题目描述 在一根无限长的数轴上,你站在0的位置。终点在target的位置。 每次你可以选择向左或向右移动。第 n 次移动(从 1 开始),可以走 n 步。 返回到达终点需要的最小移动次数。 示例 1…
[LeetCode] Binary Tree Tilt 二叉树的坡度
Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defin…
[LeetCode] Strange Printer 奇怪的打印机
There is a strange printer with the following two special requirements: The printer can only print a se…