The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dunge…
分类:LeetCode
[LeetCode] Missing Ranges 缺失区间
Given a sorted integer array where the range of elements are [0, 99] inclusive, return its missing rang…
[LeetCode] Nested List Weight Sum II 嵌套链表权重和之二
Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Ea…
[Leetcode] Implement Stack using Queues 用队列实现栈
双队列法 复杂度 时间 O(N) 空间 O(N) 思路 和Implement Queue using Stack类似,我们也可以用两个队列来模拟栈的操作。当push时,我们将数字offer进非空的队列就行了。当pop时,…
LeetCode-434. Number of Segments in a String
Description Count the number of segments in a string, where a segment is defined to be a contiguous sequence o…
Leetcode - Smallest Rectangle Enclosing Black Pixels
My code: public class Solution { int row = 0; int col = 0; public int minArea(char[][] image, int x, int y) { …
146. LRU缓存机制
题目 运用你所掌握的数据结构,设计和实现一个 LRU (最近最少使用) 缓存机制。它应该支持以下操作: 获取数据 get 和 写入数据 put 。 获取数据 get(key) - 如果密钥 (key) 存在于缓存中,则获…
[LeetCode] Combination Sum II 组合之和之二
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in&nb…
[LeetCode] Scramble String 爬行字符串
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substr…
[LeetCode] House Robber 打家劫舍
You are a professional robber planning to rob houses along a street. Each house has a certain amount of…
[LeetCode] Maximum Distance in Arrays 数组中的最大距离
Given m arrays, and each array is sorted in ascending order. Now you can pick up two integers…
[Leetcode] Merge Sorted Array 合并数组
Merge Sorted Array 最新更新请见:https://yanjia.me/zh/2019/02/… Given two sorted integer arrays nums1 and nums2…