- 博客(19)
- 收藏
- 关注
原创 59. Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ]...
2018-03-01 11:21:57
180
原创 Leetcode 55. Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you ar...
2018-02-07 22:32:39
174
原创 Leetcode 51. N-Queens 52. N-Queens II
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle.Each solu...
2018-02-07 22:26:46
292
原创 Leetcode 56. 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].根据给出的间隔集合,找出重合的集合进行重合,返回所有不重合的集合。思路:两个间隔不重合的条件是,某个间隔的end小于另一个间...
2018-02-07 22:22:32
164
原创 Leetcode 57. 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 initially sorted according to their start times.Example 1...
2018-02-07 22:20:19
210
原创 Support Vector Machine (SVM)
Support Vector Machine有两个特色:Hinge Loss我们常见的Binary Classification如下图所示,其中的Loss Function中的表示g(x)如果与Label y一样则输出0,不一样则输出1,所以损失函数变为:g在training set中总共犯了几次错。但是Loss function是不可以微分的,所以第三步不能用gr
2018-01-30 23:29:27
593
原创 Leetcode 54. Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]
2018-01-28 23:40:55
126
原创 Leetcode 53. Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1]
2018-01-26 22:55:12
147
原创 Leetcode 50. Pow(x, n)
Implement pow(x, n).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000, 3Output: 9.26100这道题就是实现pow函数,如果像下列代码一样直接进行迭代,会报StackOverflowError if(n==0)
2018-01-24 18:10:23
134
原创 Leetcode 49. Group Anagrams
Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]Note: Al
2018-01-24 11:00:41
160
原创 Leetcode 48. Rotate Image
You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the image in-place, which means you have to modify the input 2D ma
2018-01-23 15:51:58
129
原创 Transfer Learning
假设你手上有一些跟你的task没有直接相关的data,那能不能用这些data帮助我们做一些事情。比如现在要做一些分类:那不相关的data有很多可能,比如input的分布一样,都是动物,但是task的label不一样。也有一些是input不一样,但是task的label是一样的有一些不相干管的data能不能帮助我们呢?比如想找到台语的语音辨识,但是data很少,可以去扒一
2018-01-22 23:42:53
1756
1
原创 Leetcode 46. Permutations 47. Permutations II
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], [3,2,1]]给定一个数组求全排列问题,经
2018-01-18 15:05:31
184
原创 Leetcode 45. Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to rea
2018-01-17 23:36:19
138
原创 Leetcode 44. Wildcard Matching
Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching shoul
2018-01-17 13:11:29
177
原创 Leetcode 43. Multiply Strings
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2.Note:1.The length of both num1 and num2 is 2.Both num1 and num2 contains only digits 0
2018-01-16 11:20:24
117
原创 Unsupervised Learning: Deep Auto-encoder
Auto-encoder它的思想是,找一个encoder,比如input一张image,经过encoder,output一个code,它的维度要远比input小,那这个code就代表了这个input某种精简的有效的representation。但是现在问题是非监督的,我们可以找到一堆input但是不知道output是什么,那我们可以先learn一个decoder,它可以input一
2018-01-12 14:53:11
609
原创 Leetcode: 42 Trapping Rain Water
解法1:对于每个位置能储存的水量是,取左面的最高档位,右面的最高档位之中较小的那个,再减去当前的档位即可,所以最直观的解法如下:class Solution { public int trap(int[] height) { int sum = 0,left=0,right=0,now=1,maxl=0,maxr=0; int n = height.
2018-01-12 09:57:56
168
原创 Unsupervised Learning: Neighbor Embedding
Manifold Learning(流形学习)其实我们要做的事情就是降维,但是是非线性的降维。假设data其实是分布在一个低维的空间中,只是扭曲的被塞到了一个高维的空间中,比如地球的表面,它是一个二维的平面,但是被放到了一个三维的空间中。在这个manifold中,很近的情况下,欧式距离是有意义的,但是距离比较远的情况下,欧氏距离就没有意义了。上图中,123点距离比较近,那么
2018-01-11 10:27:10
351
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人