![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
茨威格的小胡子
这个作者很懒,什么都没留下…
展开
-
35. Search Insert Position [python]
一开始是用遍历的方法做的:class Solution: def searchInsert(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ if target > nums[l...原创 2018-02-27 21:51:35 · 335 阅读 · 1 评论 -
572. Subtree of Another Tree [python]
题目:Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this n...原创 2018-03-28 21:36:24 · 293 阅读 · 0 评论 -
581. Shortest Unsorted Continuous Subarray [python]
题目:Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too.You need to find...原创 2018-03-28 20:05:59 · 318 阅读 · 0 评论 -
旷视科技2018暑期实习-算法研究员面试记
下午刚刚参加了旷视科技暑期实习的面试,历时1个小时。。(可能因为程序写的太不熟练了)今年旷视在北航宣讲时我并没有参加,因此没有特意准备过什么方向,只是在官网上投了简历。投完第二天hr小姐姐就给我打电话面试了,(可能因为简历上有CV的实习经历,所以很荣幸能获得面试机会)。第一步主要讲了之前的项目经历,其中也穿插着面试官的问题,这个过程很随意,就是讨论的形式,但是面试官会以他的视角来随时提问,并且还准...原创 2018-03-27 16:39:29 · 8828 阅读 · 3 评论 -
96. Unique Binary Search Trees [python]
题目:Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \ ...原创 2018-04-01 11:16:53 · 283 阅读 · 0 评论 -
234. Palindrome Linked List [python]
题目:Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?解法:class Solution(object): def isPalindrome(self, head): """ :t...原创 2018-03-31 16:40:30 · 242 阅读 · 0 评论 -
237. Delete Node in a Linked List [python]
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with ...原创 2018-03-30 22:22:34 · 192 阅读 · 0 评论 -
19. Remove Nth Node From End of List [python]
题目:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the...原创 2018-03-30 22:07:06 · 200 阅读 · 0 评论 -
70. Climbing Stairs [python]
最一开始自己做的直接解出来了,没有用动态规划的方法求,class Solution: def zuhe(self, xia, shang): beichu = 1 chushu = 1 if xia == xia-shang+1: beichu = xia else: ...原创 2018-03-29 20:13:08 · 266 阅读 · 0 评论 -
66. Plus One [python]
题目:Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.The digits ar...原创 2018-02-28 22:20:41 · 327 阅读 · 0 评论 -
动态规划算法题复习
解题思路:找到最优子问题,尽量利用循环求解。有些问题用递归代码写起来会简单些,但是耗时会多。1. 硬币找零。题目:给出一个硬币零钱数,如change num = 79,那么在硬币种类有[1,2,5,10,15,20]情况下(硬币数无限多),最少的找零硬币数是5,然后零钱数额分别为2,2,5,20,50.python实现:def Count_coins(coins_value, change): ...原创 2018-07-09 16:18:29 · 266 阅读 · 0 评论