Implement Queue using Stacks Implement the following operations of a queue using stacks. push(x) — Push …
分类:LeetCode题目解答
[LeetCode] Sum of Left Leaves 左子叶之和
Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two left…
LeetCode 093 Restore IP Addresses
题目描述 Given a string containing only digits, restore it by returning all possible valid IP address combinations…
LeetCode | Unique Binary Search Trees II
题目: Given n, generate all structurally unique BST’s (binary search trees) that store valu…
【leetcode】23. Merge k Sorted Lists 多个有序链表的合并有序
1. 题目 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 2. 思路…
[LeetCode] Next Greater Element I 下一个较大的元素之一
You are given two arrays (without duplicates) nums1 and nums2 where nums1…
LeetCode 84. Largest Rectangle in Histogram 单调栈应用
LeetCode 84. Largest Rectangle in Histogram 单调栈应用 leetcode+ 循环数组,求右边第一个大的数字 求一个数组中右边第一个比他大的数(单调栈 LeetCode——寻找数…
24. Swap Nodes in Pairs
24. Swap Nodes in Pairs 题目 Given a linked list, swap every two adjacent nodes and return its head. For example…
[LeetCode] Two Sum II - Input array is sorted 两数之和之二 - 输入数组有序
Given an array of integers that is already sorted in ascending order, find two numbers such that they a…
[LeetCode] Zigzag Iterator 之字形迭代器
Given two 1d vectors, implement an iterator to return their elements alternately. For example, given tw…
[LeetCode] Permutation in String 字符串中的全排列
Given two strings s1 and s2, write a function to return true if s2 contains th…
[LeetCode] Exclusive Time of Functions 函数的独家时间
Given the running logs of n functions that are executed in a nonpreemptive single threaded CP…