随笔分类 -  leetcode

215. 数组中的第K个最大元素
摘要:https://leetcode-cn.com/problems/kth-largest-element-in-an-array/ 阅读全文

posted @ 2020-01-07 12:07 bug睡的略爽 阅读(132) 评论(0) 推荐(0)

1114. 按序打印
摘要:// 我们提供了一个类: // public // class Foo { // public void one() { print("one"); } // public void two() { print("two"); } // public void three() { print("three"); } // } 三个不同的线程将会共用一个 Foo 实例。 /... 阅读全文

posted @ 2019-09-26 20:22 bug睡的略爽 阅读(197) 评论(0) 推荐(0)

41. 缺失的第一个正数
摘要:1 // 给定一个未排序的整数数组,找出其中没有出现的最小的正整数。 2 // 示例 1 : 3 // 输入 : [ 1, 2, 0 ] 输出 : 3 示例 2 : 4 // 输入 : [ 3, 4, -1, 1 ] 输出 : 2 示例 3 : 5 // 输入 : [ 7, 8, 9, 11, 12 ] 输出 : 1 6 // leetcode-cn.... 阅读全文

posted @ 2019-09-22 21:26 bug睡的略爽 阅读(136) 评论(0) 推荐(0)

42. 接雨水
摘要:https://leetcode-cn.com/problems/trapping-rain-water/ 给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。 上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的高度图,在这种情况下 阅读全文

posted @ 2019-08-24 17:50 bug睡的略爽 阅读(118) 评论(0) 推荐(0)

496. 下一个更大元素 I
摘要:给定两个没有重复元素的数组 nums1 和 nums2 ,其中nums1 是 nums2 的子集。找到 nums1 中每个元素在 nums2 中的下一个比其大的值。 nums1 中数字 x 的下一个更大元素是指 x 在 nums2 中对应位置的右边的第一个比 x 大的元素。如果不存在,对应位置输出- 阅读全文

posted @ 2019-08-24 11:16 bug睡的略爽 阅读(152) 评论(0) 推荐(0)

Sort Colors
摘要:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, 阅读全文

posted @ 2016-03-15 20:05 bug睡的略爽 阅读(129) 评论(0) 推荐(0)

Climbing Stairs
摘要:70. Climbing Stairs My Submissions Question Total Accepted: 97743 Total Submissions: 269280 Difficulty: Easy You are climbing a stair case. It takes n 阅读全文

posted @ 2016-03-09 23:13 bug睡的略爽 阅读(162) 评论(0) 推荐(0)

Container With Most Water
摘要:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文

posted @ 2016-02-29 20:46 bug睡的略爽 阅读(111) 评论(0) 推荐(0)

Lowest Common Ancestor of a Binary Tree
摘要:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes 阅读全文

posted @ 2016-02-22 00:20 bug睡的略爽 阅读(201) 评论(0) 推荐(0)

Binary Tree Right Side View
摘要:Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in th 阅读全文

posted @ 2016-02-21 16:54 bug睡的略爽 阅读(179) 评论(0) 推荐(0)

Remove Duplicates from Sorted List I&&II
摘要:Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1-> 阅读全文

posted @ 2014-10-07 23:39 bug睡的略爽 阅读(192) 评论(0) 推荐(0)

Word Search
摘要:Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac 阅读全文

posted @ 2014-10-07 20:47 bug睡的略爽 阅读(297) 评论(0) 推荐(0)

Combinations
摘要:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n = 4 and k = 2, a solution is: [ [2,4], [3,4 阅读全文

posted @ 2014-10-07 16:48 bug睡的略爽 阅读(172) 评论(0) 推荐(0)

Search a 2D Matrix
摘要:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f 阅读全文

posted @ 2014-10-07 11:47 bug睡的略爽 阅读(170) 评论(0) 推荐(0)

Set Matrix Zeroes
摘要:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. click to show follow up. Follow up: Did you use extra sp 阅读全文

posted @ 2014-10-07 10:49 bug睡的略爽 阅读(128) 评论(0) 推荐(0)

Add Binary
摘要:Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 类似模拟十进制加法 阅读全文

posted @ 2014-10-06 21:57 bug睡的略爽 阅读(152) 评论(0) 推荐(0)

Minimum Path Sum
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文

posted @ 2014-10-06 19:22 bug睡的略爽 阅读(143) 评论(0) 推荐(0)

Unique Paths I&&II
摘要:Unique Paths A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or r 阅读全文

posted @ 2014-10-06 19:07 bug睡的略爽 阅读(142) 评论(0) 推荐(0)

Insert Interval
摘要:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文

posted @ 2014-10-06 18:05 bug睡的略爽 阅读(124) 评论(0) 推荐(0)

Merge Intervals
摘要:Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. 合并重复区间 先让区 阅读全文

posted @ 2014-10-06 16:32 bug睡的略爽 阅读(120) 评论(0) 推荐(0)

导航