自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

原创 leetcode 242. Valid Anagram | Map

# Description Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = "anagram", t = "...

2017-08-28 16:02:44

阅读数 161

评论数 0

原创 [京东面试问题] 求n=100w个数里面的前k=100个

# 基本思路   最复杂的方法莫过于全部排序, 复杂度nlgn. 结合求100w个数里面最大的一个数(即求max), 不需全排序, 只需开一个变量, 遍历一次记录最大值即可.那么很自然的想到, 求前k个就是开一个k大小的数组, 把历史最大/次大/次次大存起来. 也就是说, 在遍历n的时候, 对于...

2017-08-25 15:08:44

阅读数 610

评论数 0

原创 leetcode 234. Palindrome Linked List

Reversing a list is not considered “O(1) space” It is a common misunderstanding that the space complexity of a program is just how much the size o...

2017-08-13 11:24:02

阅读数 164

评论数 0

原创 leetcode 226. Invert Binary Tree | DFS 递归转迭代

DescriptionInvert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This...

2017-08-12 10:48:47

阅读数 170

评论数 0

原创 leetcode 225. Implement Stack using Queues

DescriptionImplement the following operations of a stack using queues.push(x) – Push element x onto stack. pop() – Removes the element on top of the...

2017-08-11 19:07:06

阅读数 158

评论数 0

原创 leetcode 219. Contains Duplicate II | 滑窗, Set

DescriptionGiven an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums...

2017-08-11 17:54:19

阅读数 161

评论数 0

原创 leetcode 205. Isomorphic Strings | str中字母计数(dict)与定位

DescriptionGiven two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All...

2017-08-11 16:03:54

阅读数 116

评论数 0

原创 leetcode 204. Count Primes

DescriptionCount the number of prime numbers less than a non-negative number, n.My solution 原始方案 比较朴素的想法就是迭代的找下去, 然后把找到的质数存起来, 对于下一个数, 如果他不能被前面任何一个质...

2017-08-11 14:58:26

阅读数 138

评论数 0

原创 leetcode 203. Remove Linked List Elements | 递归的更多理解

DescriptionRemove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, ...

2017-08-11 09:56:56

阅读数 98

评论数 0

原创 leetcode 202. Happy Number | 循环检测

DescriptionWrite an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any posi...

2017-08-10 23:47:35

阅读数 185

评论数 0

原创 leetcode 198. House Robber | 动态规划

DescriptionYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint...

2017-08-10 22:57:26

阅读数 180

评论数 0

原创 极大似然和交叉熵 | 深度学习

接触ML接近一年, 虽有数字信号+统计检测基础知识, 对极大似然仍然一知半解, get不到贝叶斯的思想. DL仍处于探索阶段, 只知道些名次堆砌, 今天开始读<深度学习> 这本书, 着实相见恨晚. 博客将记录个人点滴见解, 聊以备忘. 欢迎交流指正! 极大似然 因时间有限+...

2017-08-03 22:26:51

阅读数 3691

评论数 0

原创 leetcode 172. Factorial Trailing Zeroes

DescriptionGiven an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.My solution基本思...

2017-08-01 23:27:41

阅读数 224

评论数 0

原创 leetcode 169. Majority Element | 摩尔投票法

DescriptionGiven an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assu...

2017-08-01 19:10:09

阅读数 281

评论数 0

原创 leetcode 168. Excel Sheet Column Title | 进制转化

DescriptionGiven a positive integer, return its corresponding column title as appear in an Excel sheet.For example:1 -> A 2 -> B 3 -> C ... ...

2017-08-01 16:40:38

阅读数 174

评论数 0

原创 leetcode 167. Two Sum II - Input array is sorted

DescrpitionGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.T...

2017-08-01 11:19:02

阅读数 165

评论数 0

原创 leetcode 160. Intersection of Two Linked Lists

DescrpitionWrite a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A...

2017-08-01 10:49:12

阅读数 143

评论数 0

原创 leetcode 155. Min Stack | 空间换时间

DescriptionDesign a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack. pop...

2017-07-22 20:19:36

阅读数 234

评论数 0

原创 leetcode 141. Linked List Cycle

DiscriptionGiven a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?My solution:None 检测链表中有无cycl...

2017-07-22 16:06:54

阅读数 121

评论数 0

原创 leetcode 136. Single Number | XOR的巧妙运用

DescribeGiven an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runti...

2017-07-21 21:01:03

阅读数 262

评论数 0

原创 leetcode 125. Valid Palindrome | 回文string

回文str125. Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, ...

2017-07-21 18:49:51

阅读数 183

评论数 0

原创 leetcode 121. Best Time to Buy and Sell Stock | 最大差值和最大子序列关系

leetcode 121Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one...

2017-07-21 16:01:44

阅读数 284

评论数 1

原创 【LDA|ML】西瓜书习题3.4

from XiguaData import * import numpy as np x, d = load_data_3d0a() # 已知西瓜数据3.0a前8个分类为0,其余分类为1 x0 = x[:8] d0 = d[:8] x1 = x[8:] d1 = d[8:] # LDA 线性判...

2016-12-20 09:18:02

阅读数 371

评论数 0

原创 【python|ML】k-fold/leave-one-out 方法在对率回归实现(西瓜书习题3.4,数据UCI-iris)

# 经验:梯度下降要让目标确实减小(或者增大),此程序tempsum需要减小,故要着重检查!! import numpy as np def dlhg(x, d): x = np.c_[x, np.ones(d.shape[0])] w = np.random.randn(x...

2016-12-19 21:22:36

阅读数 1163

评论数 0

原创 序列圆卷积和线卷积的关系

2014-11-17 15:29:50

阅读数 716

评论数 0

提示
确定要删除当前文章?
取消 删除