2020年1月7日

215. 数组中的第K个最大元素

摘要: https://leetcode-cn.com/problems/kth-largest-element-in-an-array/ 阅读全文

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

2019年9月26日

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睡的略爽 阅读(188) 评论(0) 推荐(0) 编辑

2019年9月22日

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睡的略爽 阅读(125) 评论(0) 推荐(0) 编辑

2019年8月24日

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睡的略爽 阅读(111) 评论(0) 推荐(0) 编辑

496. 下一个更大元素 I

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

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

2016年3月22日

蒙特卡洛方法

摘要: 蒙特卡罗方法是一种计算方法。原理是通过大量随机样本,去了解一个系统,进而得到所要计算的值。 它非常强大和灵活,又相当简单易懂,很容易实现。对于许多问题来说,它往往是最简单的计算方法,有时甚至是唯一可行的方法。 它诞生于上个世纪40年代美国的"曼哈顿计划",名字来源于赌城蒙特卡罗,象征概率。 第一个例 阅读全文

posted @ 2016-03-22 21:25 bug睡的略爽 阅读(464) 评论(0) 推荐(0) 编辑

2016年3月15日

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睡的略爽 阅读(120) 评论(0) 推荐(0) 编辑

2016年3月9日

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睡的略爽 阅读(154) 评论(0) 推荐(0) 编辑

2016年2月29日

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睡的略爽 阅读(104) 评论(0) 推荐(0) 编辑

2016年2月22日

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睡的略爽 阅读(193) 评论(0) 推荐(0) 编辑

导航