这是悦乐书的第177次更新,第179篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第36题(顺位题号是155)。设计一个支持push,pop,top和在恒定时间内检索最小元素的堆栈。 pus…
标签:LeetCode
populating-next-right-pointers-in-each-node
描述: Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } P…
Connecting Graph II
Given n nodes in a graph labeled from1 to `n. There is no edges in the graph at beginning. You need to support…
186. Reverse Words in a String II
/* * 186. Reverse Words in a String II Total Accepted: 14384 Total Submissions: 49577 Difficulty: Medium Given…
LeetCode算法题-Reverse Words in a String III(Java实现)
这是悦乐书的第259次更新,第272篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第126题(顺位题号是557)。给定一个字符串,您需要反转句子中每个单词中的字符顺序,同时仍保留空格和初始单…
算法笔试题之平衡点问题
平衡点问题 平衡点问题: 一个数组中的元素,如果其前面的部分等于后面的部分,那么这个点的位序就是平衡点。 比如列表numbers = [1, 3, 5, 7, 8, 25, 4, 20],25前面的总和为24,2…
Leetcode 210. Course Schedule II
There are a total of n courses you have to take, labeled from 0 to n – 1. Some courses may have prerequi…
LeetCode689. Maximum Sum of 3 Non-Overlapping Subarrays
Solution1: Divide and Conquer This question asks for the three non-overlapping intervals with maximum sum. So …
[LeetCode][Search] 302. Smallest Rectangle Enclosing Black Pixels
Problem An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black p…
380. Insert Delete GetRandom O(1)
Medium 这个面经题一做,暴露出来不少基础问题。比如hashmap的key是不能修改的,只能remove旧的再put新的,不可以modify. 还有hashMap的key, value一定要给自己多一点思路空间,就像…
LeetCode: 翻转字符串里的单词
翻转字符串里的单词 题目叙述 给定一个字符串,逐个翻转字符串中的每个单词。 示例: 输入: “the sky is blue”, 输出: “blue is sky the”…
Merge Intervals 解题报告
题目: Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[1…