- 博客(18)
- 资源 (3)
- 收藏
- 关注
原创 142. Linked List Cycle II leetcode java
题目:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up:Can you solve it without using extra space?思路:方法是利用两个指针从...
2018-04-12 21:15:47
221
原创 141. Linked List Cycle leetcode java
题目:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?思路:判断单链表是否有环,用快慢指针解决。链表的环相当于一个圆形操场。假设有两个人在圆形操场上无限循环的跑,那么速度快的一定能追得上速度慢的。同理,若要判断一个链表是否有环,可设...
2018-04-12 19:44:34
218
原创 238. Product of Array Except Self leetcode java
题目:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O(n...
2018-04-12 12:57:38
274
原创 20. Valid Parentheses leetcode java
1.题目Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" ar
2018-01-15 11:32:22
227
原创 19. Remove Nth Node From End of List leetcode java
1.题目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 th
2018-01-12 16:37:25
222
原创 16. 3Sum Closest leetcode java
1.题目Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input woul
2018-01-12 15:21:18
278
原创 15.3sums leetcode java
1.题目Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not
2018-01-08 19:30:42
255
原创 九章算法 第二节 二分查找 Binary Search
1.二分法题目及思路题目:给定一个排好序的证书数组nums,和一个整数target,寻找target在nums中任何一个/第一次出现/最后一次出现的位置,不存在return-1。思路:基本上看到时间复杂度要求O(logN)基本就是要用二分法,二分法的本质是保留有解的一半。2.时间复杂度T(n)=T(N/2)+O(1)=O(logN)3.通用的二分法模板(四个要素)①star
2017-11-16 18:21:05
1900
原创 ?47. Permutations II leetcode java
题目:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[ [1,1,2], [1,2,1],
2017-11-10 17:44:09
263
原创 46.Permutations leetcode java
题目:Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2],
2017-11-10 14:52:34
370
原创 90.Subsets II leetcode java
题目:Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.For example,If nums = [1,2,2], a solution is:[ [2], [1], [1,2,2], [
2017-11-08 17:57:12
451
原创 九章算法 第一节 Algorithm Interview & Coding Style
1.Implement strStr()http://blog.youkuaiyun.com/abuiujhjg123456789/article/details/784797282.面试中考察内容:①coding style:变量名命名、缩进、括号②bug free:异常检测、边界处理③测试:主动给出testcase,cover掉所有情况3.排列组合模板(DFS)例子:s
2017-11-08 16:11:40
2261
1
原创 28.Implement strStr() leetcode java
题目:Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Output:
2017-11-08 15:52:05
605
原创 5.Longest Palindromic Substring leetcode java
题目:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"Output: "bab"Note: "aba" is also a valid ans
2017-11-07 16:47:09
254
原创 3. Longest Substring Without Repeating Characters leetcode java
题目:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the an
2017-11-07 15:52:09
238
原创 2. Add Two Numbers leetcode java
题目:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and r
2017-11-06 16:51:06
252
原创 1. Two Sum leetcode java
题目:给定一个整数数组和一个特定的值,返回相加等于特定值的两个数的索引,假设对每一个输入只有一个答案,相同的元素不可使用两次。思路:1.利用hashmap,遍历nums数组,如果nums[i]和hashmap中的某个数相加等于target,得到答案返回,否则,将nums[i]和i作为key和value存入hashmap。hashmap的containsKey(key)方法,
2017-11-06 11:13:13
250
python 3.6.0 64位
2017-10-21
python3.6.3 32位
2017-10-21
python-3.6.3 64位安装包
2017-10-21
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人