- 博客(18)
- 资源 (4)
- 收藏
- 关注
原创 leetcode(162):寻找峰值 Find Peak Element
题目峰值元素是指其值大于左右相邻值的元素。给定一个输入数组 nums,其中 nums[i] ≠ nums[i+1],找到峰值元素并返回其索引。数组可能包含多个峰值,在这种情况下,返回任何一个峰值所在位置即可。你可以假设 nums[-1] = nums[n] = -∞。示例:示例1:输入: nums = [1,2,3,1]输出: 2解释: 3 是峰值元素,你的函数应该返回...
2019-04-22 21:47:29 265
原创 leetcode(102): 二叉树按层遍历 Binary Tree Level Order Traversal
题目二叉树的层次遍历(广度优先搜索)20/ 12 22/ / 3 21 25/ 33也就是说这样一棵树遍历的结果为:第一种结果:[[33],[3, 21, 25],[12, 22],[20]]第二种结果:[[20],[12, 22],[3, 21, 25],[33]]第二种结果是从根按照树的高度(准确的说是按照节点的深度)遍历,得到...
2019-04-20 22:40:42 153
原创 leetcode(101): Symmetric Tree
文章目录题目解题思路:python代码一python代码2题目Easy!题目描述:给定一个二叉树,检查它是否是镜像对称的。例如,二叉树 [1,2,2,3,4,4,3] 是对称的。1/ 2 2/ \ / 3 4 4 3但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的:1/ 2 2\ 3 3说明:如果你可以运用递...
2019-04-20 21:54:13 152
原创 leetcode(287):Find the Duplicate Number
文章目录1.题目2.1二分法思路2.2指针法1.题目给定一个包含 n + 1 个整数的数组 nums,其数字都在 1 到 n 之间(包括 1 和 n),可知至少存在一个重复的整数。假设只有一个重复的整数,找出这个重复的数。示例 1:输入: [1,3,4,2,2]输出: 212示例 2:输入: [3,1,3,4,2]输出: 312说明:不能更改原数组(假设数组是只读的)...
2019-04-20 15:19:06 129
原创 leetcode(121): Best Time to Buy and Sell Stock
题目原题:给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。如果你最多只允许完成一笔交易(即买入和卖出一支股票),设计一个算法来计算你所能获取的最大利润。注意你不能在买入股票前卖出股票。示例 1:输入: [7,1,5,3,6,4]输出: 5解释: 在第 2 天(股票价格 = 1)的时候买入,在第 5 天(股票价格 = 6)的时候卖出,最大利润 = 6-1 = 5 。...
2019-04-13 22:36:31 185
转载 Python 深拷贝 浅拷贝
前几天面试碰到面试官问pythonh深拷贝和浅拷贝的问题,还好当时说了一句,python的我不太清楚,给你讲讲C++吧,blabla。。。一直都用c++刷题,Python还真不清楚,今天碰到leetcode138正好是深拷贝问题,于是用python写了一下:import copyclass Solution: def copyRandomList(self, head: 'Node'...
2019-04-10 21:34:34 188
原创 leetcode(19):Remove Nth Node From End of List
题目Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, t...
2019-04-10 00:20:46 133
原创 leetcode(17): Letter Combinations of a Phone Number
题目Letter Combinations of a Phone NumberMediumGiven a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit to l...
2019-04-09 23:52:34 140
原创 leetcode(16): 3Sum Closest
题目Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input wou...
2019-04-09 00:35:23 134
原创 leetcode(11):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 endpoints of line i is at (i, ai) and (i, 0). Find two...
2019-04-08 22:43:54 158
原创 leetcode(50):最大回文子串
题目定义回文,就是一个字符串正着念和反着念都一样,比如“abcba”,比如“上海自来水来自还上”,比如“明天到操场….”。对于这道算法题研究的英文字符串来说,有奇数回文和偶数回文两种情况。奇数回文是指回文字符串是奇数个,比如abcba;偶数回文是指回文字符串是偶数个,比如abba。在设计算法的时候应该把这两种情况都考虑在内。Given a string s, find the longes...
2019-04-08 22:00:16 143
原创 leetcode(50): Pow(x, n)
题目Implement pow(x, n).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000, 3Output: 9.26100double myPow(double x, int n) {}根据题目再加上给出的函数的返回参数和参数 我的理解是是要我们实现一个myPow函数,这个函数有...
2019-04-08 15:23:15 242
原创 计算机数据结构基础
32位和64位系统的差别https://blog.csdn.net/Sky_qing/article/details/11650497由上可见所有的问题都是由long和指针长度改变引起,在开发过程中只有牢记long和指针类型的长度。为什么Int类型负数比正数多一个32位int类型的整数取值范围是[−2^31, 2^31 − 1],我们发现正数比负数多一个,这是怎么来的呢?这里有一个0值的...
2019-04-08 11:16:05 520
原创 leetcode(21): Merge Two Sorted Lists
题目翻译:合并2个已经排序的链表,并且返回一个新的链表。这个新的链表应该由前面提到的2个链表的节点所组成。Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.E...
2019-04-07 22:31:36 251
原创 leetcode(20):Valid Parentheses
题目给定一个字符串,只包含’(‘, ‘)’, ‘{‘, ‘}’, ‘[’ 和’]’这些字符,检查它是否是“有效”的。括号必须以正确的顺序关闭,例如”()” 和”()[]{}”都是有效的,”(]” 和”([)]”是无效的。分析:本题考查的是栈结构,具有后进先出的特性。有效包含2个方面,第一个是如果是关闭的括号,前一位一定要刚好有一个开启的括号;第二个是最终结果,需要把所有开启的括号都抵消完...
2019-04-07 22:23:21 192
原创 leetcode(15):Three sum
https://www.cnblogs.com/wangkundentisy/p/9079622.html
2019-04-07 22:18:14 124
原创 leetcode(1): Two Sum
题目Two SumEasyGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may...
2019-04-07 16:24:39 95
原创 leetcode(62): Unique Paths
题目一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。问总共有多少条不同的路径?例如,上图是一个7 x 3 的网格。有多少可能的路径?说明:m 和 n 的值均不超过 100。示例 1:输入: m = 3, n = 2输出: 3解释:从左上角开...
2019-04-04 16:16:44 295
labelImg安装需要的所有资源
2018-11-29
deepling detection必读论文frcnn ssd yolo 等等
2017-12-01
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人