- 博客(51)
- 资源 (4)
- 收藏
- 关注
原创 Contiguous Array
Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.Example 1:Input: [0,1]Output: 2Explanation: [0, 1] is the longest contiguous subarray with
2017-03-28 15:39:08
466
原创 202. Happy Number
Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares
2017-03-23 23:12:54
391
原创 35. Search Insert Position
问题:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the
2017-03-23 23:08:34
391
原创 Climbing Stairs
问题:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will
2017-03-23 23:03:19
299
原创 Add Strings
问题描述Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.Note:The length of both num1 and num2 is Both num1 and num2 contains only dig
2017-03-22 16:25:48
870
原创 Power of Three
问题描述:Given an integer, write a function to determine if it is a power of three.思路:给定一个整数,判断其是否是3的次幂,也就是求以3为底,n的对数是否是整数,即log3(n),若为整数,返回true,否则返回false,利用,loga(b)=log10(b)/log10(a),来进行转换,判断其是否
2017-03-22 15:44:39
398
原创 Power of two
问题Given an integer, write a function to determine if it is a power of two.solution1思路:对于纯数字的问题,可以试着用位操作的方法来进行解决,观察下所有2的幂次方的2进制数特征:1,10,100,1000.....所有的这些2进制数都是首位为1其余为0,这是一个很明显得特征,那么根据这个特征来
2017-03-21 23:21:18
310
原创 447. Number of Boomerangs
问题描述:Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between iand j equals the distance between i and k (the
2017-03-01 21:51:36
435
原创 506. Relative Ranks
Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Silver Medal" and "Bronze Medal".Example 1:In
2017-02-12 22:27:41
1304
原创 496. Next Greater Element I
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums
2017-02-08 22:06:06
1119
原创 455. Assign Cookies
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a c
2017-02-07 23:06:56
303
原创 500. Keyboard Row
问题描述:Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.Example 1:Input: ["Hello", "Alaska"
2017-02-07 22:30:55
2421
原创 addstrings
Given two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2.Note:The length of both num1 and num2 is Both num1 and num2 contains only digits 0-9.B
2016-10-10 13:26:51
576
原创 Contains Duplicate
given an array of integers, find if the array contains any duplicates.your function should return true if any value appears at least twice in the array, and it should return false if every eleme
2016-08-29 00:40:00
477
原创 Majority Element
Given an array of size n, find the majority element.The majority element is the element that appears more than ⌊ n / 2 ⌋ times.You may assume that the array is non - empty and the majority element
2016-08-26 23:15:55
498
原创 Valid Anagram
Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.bool isAnagram(cha
2016-08-25 00:26:15
336
原创 Excel Sheet Column Number
Excel Sheet Column NumberGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA
2016-08-24 23:48:13
359
原创 Nim Game
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the
2016-08-23 23:41:23
290
原创 substring
求a是否是b的字串问题bool substring(char* ransomNote, char* magazine) { int rnum=strlen(ransomNote); int mnum=strlen(magazine); if(rnum>mnum) return false; else { char* cur
2016-08-23 23:21:55
308
原创 ransomNote
Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constru
2016-08-23 23:20:18
333
原创 ubuntu出现您的当前网络有.local域
首先终端下执行:sudo gedit /etc/default/avahi-daemon然后设置参数AVAHI_DAEMON_DETECT_LOCAL=0即可。reference:http://blog.youkuaiyun.com/djd1234567/article/details/50505140
2016-08-23 13:26:22
3503
原创 Delete Node in a Linked List
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 val
2016-08-22 16:14:43
459
原创 addDigits
/*Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only o
2016-08-22 16:07:01
504
原创 ubuntu下python+theano+keras深度学习环境搭建
一、python安装对于ubuntu,python一般是自带的,安装好的,可以再终端输入“python --version”进行查询对应的python的版本号。二 python对应深度学习库安装首先sudo apt-get update进行更新。其次sudo apt-get install python-numpy python-scipy python-dev python-
2016-08-22 15:58:12
2527
原创 安装ubuntu以及安装一些必要的软件
一 Ubuntu安装我安装的是双系统,本机已经装好的win7,再安装ubuntu一定要看清楚自己win7是以何种方式安装的,这点要非常注意。Win7的正规安装方式有4种,ubuntu的正规安装方式也是这4种:(双系统理论上提供4*4种正规安装方式)A、BIOS+MBR 传统安装方式B、CSM+MBR 注:CSM是指UEFI主板,且开启CSM,这种办法就感觉UEFI不存在一样
2016-08-22 15:48:14
873
转载 ubuntu安装chrome
ubuntu 公司估计和Google公司有些许不同意见,我们使用apt-get,还是图形软件中心都无法找到Chrome浏览器。对于这种情况,我们生可以忍,熟不能忍。下面简述安装方法:大部分的教程都是如此:一、通过直接下载安装Google Chrome浏览器deb包。打开Ubuntu终端,以下为32位版本,使用下面的命令。wget https://dl.goo
2016-08-18 18:19:53
775
原创 logistic regression 以及梯度下降
先说下线性回归(直接上图)如上图所示,根据肿瘤尺寸数据进行判断。设hypothesis函数为根据上图可以看出线性h(x)能够将上述数据进行有效分类,当h(x)>0.5,则为肿瘤患者,当h(x)此时通过调整线性模型的参数后最终得到的线性模型为蓝色的直线,此时就会发现最右侧的红色叉号被预测成了正常,这显然是不合理的,并且后果是严重的(人家有病,你预测正常,影响治疗.....),
2016-04-28 15:27:04
4121
原创 深度学习anaconda+theano使用框架配置
本文主要讲解如何在windows平台配置python深度学习框架,花了3-4天才完全配置好了python+theano,一定得好好地写一下。关于python的强大,我就不说了,自己体会吧,我也正在体会中。首先极力推荐使用它anaconda,anaconda内置地包含了numpy等各种各样的跑深度学习所需要的开源库,省掉了很多时间去独自配置这些东西。好吧,废话不多说了,现在开始。第一步 下载
2016-03-16 11:50:07
12378
转载 贝叶斯分类器,最小二乘
1贝叶斯分类器 问题:已知某条件概率,如何得到两个事件交换后的概率,也就是在已知P(A|B)的情况下如何求得P(B|A)。这里先解释什么是条件概率: 表示事件B已经发生的前提下,事件A发生的概率,叫做事件B发生下事件A的条件概率。其基本求解公式为:。 贝叶斯定理之所以有用,是因为我们在生活中经常遇到这种情况:我们可以很容易直接得出P(A|B),P(B
2016-03-01 17:09:42
1470
转载 奇异值分解svd
PS:一直以来对SVD分解似懂非懂,此文为译文,原文以细致的分析+大量的可视化图形演示了SVD的几何意义。能在有限的篇幅把这个问题讲解的如此清晰,实属不易。原文举了一个简单的图像处理问题,简单形象,真心希望路过的各路朋友能从不同的角度阐述下自己对SVD实际意义的理解,比如 个性化推荐中应用了SVD,文本以及Web挖掘的时候也经常会用到SVD。英文原文:We recommend a sing
2015-12-23 18:07:32
1211
转载 svd奇异值分解
原文地址:http://blog.youkuaiyun.com/wangzhiqing3/article/details/7446444/SVD分解SVD分解是LSA的数学基础,本文是我的LSA学习笔记的一部分,之所以单独拿出来,是因为SVD可以说是LSA的基础,要理解LSA必须了解SVD,因此将LSA笔记的SVD一节单独作为一篇文章。本节讨论SVD分解相关数学问题,一个分为3个部
2015-12-23 18:06:06
923
原创 直方图均衡化
直方图均衡化是一种典型的通过对图像进行修正来获得图像增强效果的自动方法。1、直方图和累计直方图直方图是通过对图像的统计得到的。对于一幅灰度图像,其灰度直方图反映了该图中不同灰度级出现的统计情况。如下图所示,一个4x4的图像的灰度级有4个,分别是0,1,2,3,分布如下右侧的h(f)=nf(f是下标,f=0,1,...,L-1,代表灰度值)是其对应的直方图分布,是1xD的离散函数
2015-11-12 00:03:38
1458
原创 图像基础二值化
图像的二值化,就是将图像上的像素点的灰度值设置为0或255,也就是将整个图像呈现出明显的只有黑和白的视觉效果。一幅图像包括目标物体、背景还有噪声,要想从多值的数字图像中直接提取出目标物体,最常用的方法就是设定一个阀值T,用T将图像的数据分成两个部分:大于T的像素群和小于T的像素群。这是研究灰度变换的最特殊方法,成为图像的二值化。全局二值化一幅图像包括目标物体、背景还有噪声,要想从多值的
2015-11-11 23:26:14
1213
原创 sift论文看后理解
近来发现,只看论文是不行的,论文看完了,当时可能明白的马马虎虎,过几天在遇到这个东西,又忘记了,还是写点东西,记录下吧。SIFT,即尺度不变特征变换(Scale-invariant feature transform,SIFT),该算法具有尺度不变性,对于旋转角度,图像亮度或拍摄角度改变具有一定的不变性。sift的一个重要方面在于,它能够产生大量的特征,这些特征在尺度和坐标上能够很好的覆盖图片
2015-11-06 22:02:12
5571
2
原创 jpg转换pgm(其他图片格式转换类似)
最近在看sift,下载了lowe的代码,发现使用的图像时pgm格式的,自己的多数图片是jpg格式的,就开始进行转换。其实还是比较简单明了的附代码如下function jpg2pgm( inputImage )%JPG2PGM Summary of this function goes here% Detailed explanation goes here% inputImage为
2015-11-04 17:01:20
6904
1
转载 ELM基础
ELM(Extreme Learning Machine)是一种新型神经网络算法,最早由Huang于2004年提出【Extreme learningmachine: a new learning scheme of feedforward neural networks】。elm特点是随机生成隐层节点的参数,训练模型速度快。elm从网络结构上来看是一个单隐层的前馈神经网络(SLFN)如
2015-09-27 16:47:03
8280
转载 matlab里边的textread函数详解
原文在这里今天打算跑下程序,突然发现,真的很烂,不会读入数据,简单的Iris.txt一上午都没读进去,在此对matlab中的textread函数做下总结,textscan函数待续。本文主要内容引自http://linux.chinaitlab.com/administer/872894.html笔者在此基础上进行运行,修改得到以下内容,希望大家给与补充:textread基本语法
2015-04-29 23:41:41
959
转载 感知器
原文在这里感知器是由美国计算机科学家罗森布拉特(F.Roseblatt)于1957年提出的。感知器可谓是最早的人工神经网络。单层感知器是一个具有一层神经元、采用阈值激活函数的前向网络。通过对网络权值的训练,可以使感知器对一组输人矢量的响应达到元素为0或1的目标输出,从而实现对输人矢量分类的目的。图4.1给出了单层感知器神经元模型图。
2015-04-29 12:18:28
2349
转载 浅析人脸检测之Haar分类器方法
原文地址:点击打开链接 http://www.cnblogs.com/ello/archive/2012/04/28/2475419.html 浅析人脸检测之Haar分类器方法[补充] 这是我时隔差不多两年后, 回来编辑这篇文章加的这段补充, 说实话看到这么多评论很是惊讶, 有很多评论不是我不想回复, 真的是时间久了, 很多细节我都忘记了, 无力回复, 非常抱歉.
2015-03-28 23:31:39
633
转载 离散数学蕴含等值式前件为假命题为真的理解
蕴含等值式:P->Q~PvQ,如何理解P为假时,P->Q为真命题?蕴含式P->Q表示,如果P那么Q,显然:如果P为真则Q为真,P→Q是真命题,当P为真命题,而Q为假命题时,P→Q是一个假命题。比如张三说,“如果明天天不下雨(P),那么他去你家玩(Q)”,如果第二天天不下雨,他去了你家,他说了真话(P→Q为真),如果天不下雨,但他没有去你家,显然他说了谎话(此时P→Q为假)。但是当P为假时,
2015-03-01 16:11:10
7277
2
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人