题目地址:https://leetcode-cn.com/probl…题目描述:写一个 RecentCounter 类来计算最近的请求。 它只有一个方法:ping(int t),其中 t 代表以毫秒为单位的某…
分类:LeetCode题目解答
8. String to Integer (atoi)
8. String to Integer (atoi) 题目 Implement atoi to convert a string to an integer. Hint: Carefully consider all …
[LeetCode] Transpose File 转置文件
Given a text file file.txt, transpose its content. You may assume that each row has the same numbe…
LeetCode | Spiral Matrix II
题目: Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral or…
123. Best Time to Buy and Sell Stock III
欢迎fork and star:Nowcoder-Repository-github 123. Best Time to Buy and Sell Stock III 题目 Say you have an array f…
[LeetCode] Reverse Vowels of a String 翻转字符串中的元音字母
Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Given …
LeetCode | Max Points on a Line
题目: Given n points on a 2D plane, find the maximum number of points that lie on the same straight …
LeetCode | Insertion Sort List
题目: Sort a linked list using insertion sort. 思路: 常规的插入排序,直接上代码。 代码: /** * Definition for singly-linked list. *…
LeetCode | Restore IP Addresses
题目: Given a string containing only digits, restore it by returning all possible valid IP address combinations.…
[LeetCode] Paint House 粉刷房子
There are a row of n houses, each house can be painted with one of the three colors: red, blu…
[LeetCode] Convert BST to Greater Tree 将二叉搜索树BST转为较大树
Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST …
[LeetCode] Redundant Connection 冗余的连接
In this problem, a tree is an undirected graph that is connected and has no cycles. The given…