上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 22 下一页
摘要: 题目链接:https://leetcode-cn.com/problems/longest-palindromic-subsequence 题目描述: 给你一个字符串 s ,找出其中最长的回文子序列,并返回该序列的长度。 子序列定义为:不改变剩余字符顺序的情况下,删除某些字符或者不删除任何字符形成的 阅读全文
posted @ 2021-08-12 13:45 张宵 阅读(136) 评论(0) 推荐(0)
摘要: 题目链接:https://leetcode-cn.com/problems/balance-a-binary-search-tree 题目描述: 给你一棵二叉搜索树,请你返回一棵 平衡后 的二叉搜索树,新生成的树应该与原来的树有着相同的节点值。 如果一棵二叉搜索树中,每个节点的两棵子树高度差不超过 阅读全文
posted @ 2021-08-11 12:28 张宵 阅读(240) 评论(0) 推荐(0)
摘要: 题目链接:https://leetcode-cn.com/problems/longest-palindrome 题目描述: 给定一个包含大写字母和小写字母的字符串,找到通过这些字母构造成的最长的回文串。 在构造过程中,请注意区分大小写。比如 "Aa" 不能当做一个回文字符串。 注意: 假设字符串的 阅读全文
posted @ 2021-08-11 10:44 张宵 阅读(29) 评论(0) 推荐(0)
摘要: 题目链接:https://leetcode-cn.com/problems/arithmetic-slices 题目描述: 如果一个数列 至少有三个元素 ,并且任意两个相邻元素之差相同,则称该数列为等差数列。 例如,[1,3,5,7,9]、[7,7,7,7] 和 [3,-1,-5,-9] 都是等差数 阅读全文
posted @ 2021-08-10 14:54 张宵 阅读(162) 评论(0) 推荐(0)
摘要: 题目链接:https://leetcode-cn.com/problems/last-stone-weight-ii 题目描述: 有一堆石头,用整数数组 stones 表示。其中 stones[i] 表示第 i 块石头的重量。 每一回合,从中选出任意两块石头,然后将它们一起粉碎。假设石头的重量分别为 阅读全文
posted @ 2021-08-09 11:04 张宵 阅读(55) 评论(0) 推荐(0)
摘要: **题目链接:**https://leetcode-cn.com/problems/next-permutation 题目描述: 实现获取 下一个排列 的函数,算法需要将给定数字序列重新排列成字典序中下一个更大的排列。 如果不存在下一个更大的排列,则将数字重新排列成最小的排列(即升序排列) 必须 原 阅读全文
posted @ 2021-08-08 15:42 张宵 阅读(38) 评论(0) 推荐(0)
摘要: 题目链接:https://leetcode-cn.com/problems/circular-array-loop 题目描述: 存在一个不含 0 的 环形 数组 nums ,每个 nums[i] 都表示位于下标 i 的角色应该向前或向后移动的下标个数: 如果 nums[i] 是正数,向前 移动 nu 阅读全文
posted @ 2021-08-07 15:51 张宵 阅读(110) 评论(0) 推荐(0)
摘要: 题目链接:https://leetcode-cn.com/problems/largest-rectangle-in-histogram/submissions/ 题目描述: 题解: class Solution { public: int largestRectangleArea(vector<i 阅读全文
posted @ 2021-08-06 17:30 张宵 阅读(36) 评论(0) 推荐(0)
摘要: 题目链接:https://leetcode-cn.com/problems/trapping-rain-water/ 题目描述: 题解: class Solution { public: int trap(vector<int>& height) { vector<int> maxLeft(heig 阅读全文
posted @ 2021-08-05 17:01 张宵 阅读(99) 评论(0) 推荐(0)
摘要: 题目链接:https://leetcode-cn.com/problems/matchsticks-to-square/ 题目描述: 题解: class Solution { public: bool makesquare(vector<int>& matchsticks) { vector<boo 阅读全文
posted @ 2021-08-04 21:29 张宵 阅读(56) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 22 下一页