自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(64)
  • 收藏
  • 关注

原创 纵向编辑vim

ctrl + v进入Visual Block 模式,选中某几行按r键进入切换模式,输入要切换的内容按I键进入左添加模式,输入要切换的内容,输入完后ESC完成添加按A键进入右添加模式,输入要切换的内容,输入完后按ESC完成添加

2017-01-02 22:04:48 2591

原创 [Leetcode]220. Contains Duplicate III @python

题目Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums[j] is at most t and the difference between i and j i

2016-02-26 23:49:35 1549

原创 [Leetcode]214. Shortest Palindrome@python

题目Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can find by performing this transformation.For example

2016-02-25 22:25:36 1022

原创 [Leetcode] 212. Word Search @python

题目Given a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizo

2016-02-25 19:59:33 1260

原创 [Leetcode]211. Add and Search Word - Data structure design @python

题目Design a data structure that supports the following two operations:void addWord(word) bool search(word) search(word) can search a literal word or a regular expression string containing only letters

2016-02-05 22:00:44 806

原创 [Leetcode]201. Bitwise AND of Numbers Range @python

题目Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.For example, given the range [5, 7], you should return 4.题目要求给定m和n要求m到n的所有数字相与的结果。

2016-02-05 21:05:03 896

原创 [Leetcode]188. Best Time to Buy and Sell Stock IV@python

题目Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most k transactions.Note: You may not engag

2016-02-05 20:49:23 604

原创 [Leetcode] 179. Largest Number @python

题目Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result may be very larg

2016-02-05 17:00:05 2686

原创 [Leetcode]174. Dungeon Game @python

题目The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially po

2016-02-05 16:25:48 623

原创 [Leetcode]166. Fraction to Recurring Decimal @python

题目Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses.For ex

2016-02-05 15:09:37 676

原创 [Leetcode]152. Maximum Product Subarray @python

题目Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the largest pro

2016-02-05 14:30:35 646

原创 [Leetcode]149. Max Points on a Line @python

题目Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.题目要求给定n个2维平面上的点,找到在同一直线上最多的点数。解题思路在同一直线上要求所有点的斜率相同且经过同一个点。同时要考虑,斜率可能为无穷大,也有可能两个点为同一个点。代码# Definition

2016-02-05 14:06:11 736 1

原创 [Leetcode]146. LRU Cache @python

题目Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of the key if the

2016-01-29 13:56:46 1431

原创 [Leetcode]142. Linked List Cycle II @python

题目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?题目要求给定一个链表,如果

2016-01-28 12:08:55 999

原创 [Leetcode]126. Word Ladder II python

题目Given two words (beginWord and endWord), and a dictionary’s word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:Only one letter can be changed at a time Each

2016-01-24 23:42:52 2418

原创 [Leetcode]127. Word Ladder@python

题目Given two words (beginWord and endWord), and a dictionary’s word list, find the length of shortest transformation sequence from beginWord to endWord, such that:Only one letter can be changed at a tim

2016-01-24 22:33:15 1556

原创 [Leetcode]105. Construct Binary Tree from Preorder and Inorder Traversal@python

题目Given preorder and inorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree.题目要求给定对一个binary-tree的前序遍历和中序遍历。重建二叉树。解题思路前序遍历的第一个值为根节点的值,在中序遍历

2016-01-24 14:17:16 831

原创 [Leetcode] 98. Validate Binary Search Tree @python

题目Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node’s key. The rig

2016-01-24 13:49:55 634

原创 [Leetcode]97. Interleaving String @python

题目Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example, Given: s1 = “aabcc”, s2 = “dbbca”,When s3 = “aadbbcbcac”, return true. When s3 = “aadbbbaccc”, return fal

2016-01-24 12:40:50 468

原创 [Leetcode]91. Decode Ways@python

题目A message containing letters from A-Z is being encoded to numbers using the following mapping:‘A’ -> 1 ‘B’ -> 2 … ‘Z’ -> 26 Given an encoded message containing digits, determine the total number

2016-01-23 18:38:34 1292

原创 [leetcode]87. Scramble String @python

题目Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = “great”: great / \ gr

2016-01-23 13:48:26 621

原创 [Leetcode]Search in Rotated Sorted Array II

题目Follow up for “Search in Rotated Sorted Array”: What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function to determine if a given target is in the array.

2016-01-23 13:19:42 216

原创 [Leetcode]76. Minimum Window Substring @python

题目Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example, S = “ADOBECODEBANC” T = “ABC” Minimum window is “BANC”.Note

2016-01-21 21:52:24 1328

原创 [Leetcode]68. Text Justification @python

题目Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You should pack your words in a greedy approach; that is,

2016-01-20 22:14:43 992

转载 修改apache服务器根目录

In my Ubuntu 14.04 LTS, the document root was set to /var/www/html. It was configured in the following file:/etc/apache2/sites-available/000-default.conf So just do asudo nano /etc/apache2/sites-avail

2016-01-20 19:31:00 524

转载 转载:阿里云服务器 ECS Ubuntu系统安装配置

转自阿里云服务器 ECS Ubuntu系统安装配置 要查看图文详细说明,请点击上面的链接看原文。 ssh root@公网IP 阿里云服务器-ECS-Ubuntu系统安装配置-6输入root密码进行登录阿里云服务器-ECS-Ubuntu系统安装配置-7修改root账号密码并新建一个管理账户 为了安全起见,必须改掉初始的root用户密码,另建一个足够复杂强度的新密码。输入命令passwd

2016-01-20 18:50:35 1403

翻译 [Deeplearning]5监测学习过程(from A practical guide to training restricted boltzmann machine)

最简单的监测学习过程的方法,就是计算数据和重建可见层数据的平方和误差。 但是平方和误差并不能很准确的表示学习的效果。 小的平法误差和并不能表示模型开始变得不好,但是大的平方误差和通常意味着模型开始变的不好了。但也有可能是学习速率、冲量、权重cost、稀疏性参数改变导致的平方和误差的大的改变。 对此,Hinton给的建议是,使用平方和误差作为监测学习过程的手段,但是并不完全相信它。 如果你有l

2016-01-20 17:12:29 538

翻译 [Deeplearning]mini-batch大小的选择

内容来在 A Practical Guide to Training Restricted Boltzmann Machines mini-batch 的大小通常选为10-100。 为了避免在改变mini-batch大小时需要改变学习速率,所以需要将在mini-batch上得到的梯度处理mini-batch的大小。 如果选择随机梯度下降的方法进行优化,最好不要将mini-batch的大小设置的

2016-01-20 16:51:42 6481

翻译 [DeepLearning]如何使用对比散度(How to use Contrastive Divergence)

假设可见层和隐藏层单元都是二值的。学习的目的是针对训练数据构建一个好的生成模型。更新隐藏层假设隐藏层单元是二值的,而且使用的是CD1CD_1,隐藏层单元在通过数据向量驱动得到时应该具有随机的二值状态。隐藏层单元置为1的概率为 p(hj=1)=σ(bj+∑iviWij)p(h_j=1)=\sigma (b_j + \sum_i v_iW_{ij}) 随机生成一个均匀分布的0到1之间的值,如果该值大

2016-01-20 14:47:22 2100

翻译 [Deeplearning]对比散度算法(CD算法)

本篇博文是对基于能量的模型和波尔兹曼机关于对比散度算法的总结。对比散度算法(Contrastive Divergence)尽管利用Gibbs采样,我们可以得到对数似然函数关于未知参数梯度的近似,但是通常情况下,需要使用较大的采样步数,这使得RBM的训练效率仍然不高,尤其当观测数据的特征维数较高时。2002年Hinton提出了RBM的一个快速学习算法,对比散度算法(Contrastive Diverg

2016-01-19 15:23:38 23834 1

转载 [DeepLearning] Gibbs采样

本篇博文是对基于能量的模型和波尔兹曼机关于Gibbs采样的总结。 Gibbs采样是一种基于马尔可夫链蒙特卡罗(Markov Chain Monte Carlo,MCMC)策略的采样方法。对于一个K维随机向量X=(X1,X2,...,Xk)X=(X_1,X_2,...,X_k),假设我们无法求得关于X的联合概率分布P(X),但是我们知道在给定X的其它分量时,其第kk个分量XkX_k的条件分布,即P(

2016-01-19 14:59:40 992

转载 [Deeplearning]能量模型(EBM)

本篇博客是对基于能量的模型和波尔兹曼机学习的总结。1. 基于能量的模型(EBM)基于能量的模型主要有两个任务,一个是推断(Inference),在给定观察变量的情况下,找到使能量值最小的那些隐变量的配置。另一个是学习(Learning),寻找一个恰当的能量函数,使得观察变量的能量比隐变量的能量低。 基于能量的概率模型通过一个能量函数来定义概率分布。 p(x)=e−E(x)Z...(1)p(x)=

2016-01-19 14:45:25 8476 1

原创 [Leetcode]61. Rotate List @python

题目Given a list, rotate the list to the right by k places, where k is non-negative.For example: Given 1->2->3->4->5->NULL and k = 2, return 4->5->1->2->3->NULL.题目要求给定链表和非负数k,将链表内的元素向右移动k位。解题思路解题思路参考南郭

2016-01-18 22:44:37 371

原创 [Leetcode]54. Spiral Matrix @python

题目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 ] ] You

2016-01-18 21:27:37 1317

原创 [Leetcode] 50. Pow(x, n) @python

题目Implement pow(x, n).题目要求实现x的n次幂。解题思路此题参考南郭子綦 自己想了很久,没想到用这么几行代码就搞定了。 采用递归来实现二分。分以下四种情况考虑: 1. n ==0 ,返回1.0 2. n < 0, 返回1/pow(x,-n) 3. n % 2 == 0,返回pow(x*x,n/2) 4. n % 2 == 1,返回pow(x*x,n/2) * x$代码

2016-01-18 20:58:37 735

原创 [Deeplearning]RBM-hinton代码解读

解读hintonRBM的matlab实现关于RBM(受限波尔玆曼机)受限波尔玆曼机是生成式模型。输入数据可以根据概率生成出来。 RBM通常用contrastive divergence来进行训练,这是Hinton在2002年提出来的。将在后续的博文中对其进行介绍。 RBM由两层组成,一层可见层,一层隐藏层。由隐藏层对可见层数据进行特征提取。可见层可以为二值或实数值,隐藏层为二值。网络的能量由以下

2016-01-18 13:49:47 5186 2

原创 [Leetcode]43. Multiply Strings @python

题目Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.题目要求给定两个用字符串表示的数字,进行乘法运算,并且返回结果用字符串表示。解题思路先将

2016-01-17 13:12:47 1191

原创 [Leetcode]36. Valid Sudoku@python

题目Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’. A partially filled sudoku

2016-01-17 12:13:06 449

原创 [Leetcode]32. Longest Valid Parentheses @python

题目Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, which h

2016-01-17 11:30:43 1010

原创 [Leetcode] 15.3Sum @python

题目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: Elements in a triplet (a,b,c) must be

2016-01-16 23:16:51 269

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

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