摘要: https://leetcode-cn.com/problems/split-a-string-in-balanced-strings/ 在一个「平衡字符串」中,'L' 和 'R' 字符的数量是相同的。 给出一个平衡字符串 s,请你将它分割成尽可能多的平衡字符串。 返回可以通过分割得到的平衡字符串的 阅读全文
posted @ 2019-11-09 19:31 xyy999 阅读(235) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/kth-largest-element-in-a-stream/submissions/ 设计一个找到数据流中第K大元素的类(class)。注意是排序后的第K大元素,不是第K个不同的元素。 你的 KthLargest 类需要一个同时接 阅读全文
posted @ 2019-11-09 13:40 xyy999 阅读(159) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/last-stone-weight/ 有一堆石头,每块石头的重量都是正整数。 每一回合,从中选出两块最重的石头,然后将它们一起粉碎。假设石头的重量分别为 x 和 y,且 x <= y。那么粉碎的可能结果如下: 如果 x == y,那么 阅读全文
posted @ 2019-11-07 16:48 xyy999 阅读(161) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/valid-parentheses/ 给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效。 有效字符串需满足: 左括号必须用相同类型的右括号闭合。左括号必须以正确的顺序闭合。注意空字符串可被认 阅读全文
posted @ 2019-11-07 00:01 xyy999 阅读(163) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/min-stack/ 设计一个支持 push,pop,top 操作,并能在常数时间内检索到最小元素的栈。 push(x) -- 将元素 x 推入栈中。pop() -- 删除栈顶的元素。top() -- 获取栈顶元素。getMin() 阅读全文
posted @ 2019-11-05 21:40 xyy999 阅读(131) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/implement-stack-using-queues/ 使用队列实现栈的下列操作: push(x) -- 元素 x 入栈pop() -- 移除栈顶元素top() -- 获取栈顶元素empty() -- 返回栈是否为空 注意: 你只 阅读全文
posted @ 2019-11-04 21:54 xyy999 阅读(134) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/implement-queue-using-stacks/ 使用栈实现队列的下列操作: push(x) -- 将一个元素放入队列的尾部。pop() -- 从队列首部移除元素。peek() -- 返回队列首部的元素。empty() -- 阅读全文
posted @ 2019-11-03 19:31 xyy999 阅读(103) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/next-greater-element-i/ 给定两个没有重复元素的数组 nums1 和 nums2 ,其中nums1 是 nums2 的子集。找到 nums1 中每个元素在 nums2 中的下一个比其大的值。 nums1 中数字  阅读全文
posted @ 2019-11-03 10:30 xyy999 阅读(112) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/baseball-game/solution/bang-qiu-bi-sai-by-leetcode/ 你现在是棒球比赛记录员。给定一个字符串列表,每个字符串可以是以下四种类型之一:1.整数(一轮的得分):直接表示您在本轮中获得的积分 阅读全文
posted @ 2019-10-31 22:52 xyy999 阅读(151) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/backspace-string-compare/ 给定 S 和 T 两个字符串,当它们分别被输入到空白的文本编辑器后,判断二者是否相等,并返回结果。 # 代表退格字符。 示例 1: 输入:S = "ab#c", T = "ad#c" 阅读全文
posted @ 2019-10-30 15:59 xyy999 阅读(151) 评论(0) 推荐(0)