自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(123)
  • 资源 (12)
  • 收藏
  • 关注

原创 在Mac OS 10.11上安装python, pyqt

1.首先安装homebrew,通过在终端中执行如下的命令:ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)" 2.接着安装pythonbrew install python3.通过编辑edit ~/.profile文件把python加入环境变量export PATH=

2016-02-19 11:31:59 3112 2

原创 机器学习基石第四次作业代码

花了一个多月总算把《机器学习基石》这门公开课学习完了,作业也做完了,老师讲的很棒,学到了不少东西:).Q13Q14Q15Q16Q17Q18Q19Q20import sysimport urllib2import numpy as npfrom math import exp#Download data# url = 'https://d396qusza40orc.cloudfront.net

2016-01-15 22:41:18 1233

原创 机器学习基石第三次课代码

机器学习基石第三次课代码import urllib2import numpy as npfrom math import exp# url = 'https://d396qusza40orc.cloudfront.net/ntumlone%2Fhw3%2Fhw3_test.dat'# f = urllib2.urlopen(url)# with open("hw3_train.dat", "

2016-01-13 00:15:33 621

原创 Machine Learning Foundations(NTU) 第一次作业

Machine Learning Foundations(NTU) 第一次作业PLADATA: https://d396qusza40orc.cloudfront.net/ntumlone%2Fhw1%2Fhw1_15_train.dat Each line of the data set contains one (xn,yn) with xn∈R4. T he first 4 numbers

2016-01-07 16:15:06 817

原创 修复 mac os 升级后导致的xcrun: error:

最近升级MAC OS 10.11以后,git莫名其妙的不能用了。当Git clone 一个开源项目时,提示如下错误: xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/

2015-11-23 19:55:40 1782

原创 First Bad Version

原题: You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on

2015-09-13 10:49:18 369

原创 H-Index

原题如下: Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index.According to the definition of h-index on Wikipedia: “

2015-09-07 10:30:01 507

原创 Same Tree

原题: Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.解题: 递归判断每个位置的

2015-08-26 21:31:31 324

原创 Group Anagrams

原题: Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example: Given the following binary tree, 1

2015-08-25 14:23:01 3404

原创 Best Time to Buy and Sell Stock III

原题: 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 two transactions.Note: You may not

2015-08-24 23:28:47 389

原创 Scramble String

原题: 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 eat

2015-08-24 20:40:04 352

原创 Binary Tree Right Side View

原题: Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example: Given the following binary tree, 1

2015-08-24 18:40:05 312

原创 Missing Number

原题: Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.For example, Given nums = [0, 1, 3] return 2.解题: 寻找连续的N个数中缺失的那个数,那么直接用原来N个数的和减去

2015-08-24 09:46:18 561

原创 House Robber II

原题: Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time

2015-08-23 18:45:38 292

原创 House Robber

原题: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent h

2015-08-23 14:03:04 300

原创 Best Time to Buy and Sell Stock II

原题: 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 as many transactions as you like (ie, buy on

2015-08-22 16:15:13 342

原创 Reverse Nodes in k-Group

原题: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is

2015-08-22 16:02:58 334

原创 String to Integer (atoi)

原题: Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca

2015-08-22 14:30:23 350

原创 Invert Binary Tree

原题: Invert a binary tree.4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This problem was inspired by this original tweet by Max How

2015-08-22 14:20:02 362

原创 Majority Element II

原题: Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.解题: 这个其实跟编程之美上面的“寻找发帖水王”的题如出一辙,也就是寻找一个数组中超过一半的元素

2015-08-22 13:28:31 362

原创 Sliding Window Maximum

原题: Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding wind

2015-08-22 00:25:59 901

原创 Path Sum II

原题: Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.For example: Given the below binary tree and sum = 22, 5 / \

2015-08-22 00:06:13 814

原创 Reverse Linked List II

原题: Reverse a linked list from position m to n. Do it in-place and in one-pass.For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note: Given m, n satisfy the followi

2015-08-21 22:28:21 889

原创 Container With Most Water

原题: Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find tw

2015-08-21 10:53:23 631

原创 Rotate List

原题: 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为0时原串返回,k>0时对链

2015-08-20 17:34:07 259

原创 Gas Station

原题: There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to it

2015-08-20 16:51:06 351

原创 Minimum Path Sum

原题: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at

2015-08-20 15:16:53 677

原创 Binary Tree Preorder Traversal

原题: Given a binary tree, return the preorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3].Note: Recursive solution is tri

2015-08-20 14:12:26 740

原创 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 ] ] Y

2015-08-20 13:52:23 873

原创 Search for a Range

水题一道: Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If the target is not found in

2015-08-20 10:57:06 1027

原创 Search a 2D Matrix

原题如下: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right. The first integer of each

2015-08-20 10:43:46 585

原创 Unique Paths

原题如下(链接:https://leetcode.com/problems/unique-paths/): A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at an

2015-08-19 19:00:19 812

原创 Ugly Number II(求第N个丑数)

这个应该是微软的一道面试题,首先需要明白丑数的概念。1是一个特殊的丑数,其次只含有2,3,5质因数的数被定义为丑数。 关于解题的思路可以参考: http://www.geeksforgeeks.org/ugly-numbers/ 1到N的丑数为 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, … ; 可以分成如下三组:(1) 1×2, 2×2, 3×2, 4×2, 5

2015-08-19 14:49:22 6907 2

原创 Interleaving String

原题如下: 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”, retur

2015-08-19 11:04:20 742

原创 Reorder List

原题如下:Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reo

2015-08-18 23:54:04 592

原创 Gerrit简单使用

Gerrit参考文档: http://gerrit-documentation.googlecode.com/svn/Documentation/2.4.2/index.html 权限控制: http://openwares.net/linux/gerrit_privilege_setup.html gerrit不允许使用:git push origin master将本地的tracking

2015-08-11 10:42:06 906

原创 为什么父进程不处理标准输入输出子进程会挂起(Java)?

最近写Java的多进程程序时遇到一个奇怪的问题,发现程序运行一段时间以后会自动挂起。按道理来说子进程和父进程之间是没有太大的关系的,父进程只是用于开启一个新的子进程,之后就没怎么联系了。最后查到了stackoverflow上面的一片帖子,写的不错。http://stackoverflow.com/questions/16983372/why-does-process-hang-if-the-pare

2015-08-05 15:23:10 2240

原创 Python中为什么没有++和--(自增/减)

这两天看了一些网上各大互联网公司的面试题,发现腾讯特别喜欢考察++和–以及移位运算相关的内容。C++相对来说还是比较熟悉的,对于这类问题只要记住运算符的优先级一般问题不大。由于也会经常用Python,突然觉得Python中通为什么没有自增自减运算符呢?比如python中有x += y这种形式的表达式,但是没有x++这样的。查了一些资料,发现+=是代表改变了变量,相当于重新生成了一个变量,把操作后的

2015-08-04 11:00:59 5380

原创 Python中为什么没有++和--(自增/减)

这两天看了一些网上各大互联网公司的面试题,发现腾讯特别喜欢考察++和–以及移位运算相关的内容。C++相对来说还是比较熟悉的,对于这类问题只要记住运算符的优先级一般问题不大。由于也会经常用Python,突然觉得Python中通为什么没有自增自减运算符呢?比如python中有x += y这种形式的表达式,但是没有x++这样的。查了一些资料,发现+=是代表改变了变量,相当于重新生成了一个变量,把操作后的

2015-08-04 11:00:27 6492

原创 关于线程通信的通俗解释

线程通信主要分为以下几个部分,下面通过生活中图书馆借书的例子简单讲解以下:通过共享对象通信加入图书馆只有一本《java并发编程实战》,小A早上的时候把这本书给借走了,然后下午小B去图书馆去找这本书,这时候小A和小B是两个线程,《java并发编程实战》就是共享对象(类似于多线程中的全局变量的资源),小B发现这本书已经被借走了,所以就回去等了几天,几天后,小B又去图书馆发现这本书被还回来了,就把书借走

2015-07-19 17:11:13 937

Android屏幕共享PC端程序

http://blog.csdn.net/guang09080908/article/details/41413449#reply,这个是对应的Android的版本,两者一个是server端,一个是Android端,配合使用即可。

2015-05-31

android截屏(root)

android root截屏,可以正常使用

2014-12-16

求最大公约数(求公因数部分很经典的)

算法 1.连续整数检测 1. t = min {m , n}; 2. m 除以t , 如果余数为 0 , 则执行步骤 3 , 否则,执行第 4 步; 3. n 除以 t , 如果余数为 0 ,返回t 的值作为结果, 否则, 执行第 4 步; 4. t = t - 1 ,转第 2 步; 算法 2.欧几里得算法 1 . r = m % n ; 2 . 循环直到 r = 0 2 .1 m = n ; 2 .2 n = r ; 2 .3 r = m % n ; 3 . 输出n ; 算法 3.分解质因数

2011-11-06

n枚硬币问题

在n枚外观相同的硬币中, 有一枚是假币, 并且已知假币与真币的重量不同, 但不知道假币与真币相比较轻还是较重。可以通过一架天平来任意比较两组硬 币, 设计一个高效的算法来检测出这枚假币。

2011-11-06

最近对问题

很经典的题哦,亲!设p1(x1,y1),p2(x2,y2),…,pn(xn,yn)是平面上n个点构成的集合,设计算法找出集合S中距离最近的对。 (1)分别用蛮力法和分治法求解最近对问题;

2011-11-06

串匹配问题(包含三个算法:BM,BF.KMP)

(1)实现BF算法; (2)实现BF算法的改进算法: KMP算法和 BM 算法; (3) 对上述3个算法进行时间复杂性分析,并设计实验程序验证分析结果。

2011-11-06

最大子段和(很好的东东)

给定由n个整数(可能又负整数)组成的序列(a1,a2,a3,…,an),求该序列形如 的子段和的最大值,当所有的整数均为负整数时,其最大子段和为0.

2011-11-06

背包算法(超级好)

很典型的背包问题,C++算法实现,很经典,可以下载下来仔细看看~

2011-11-06

100个linux陷进和技巧

linux中的一些很实用的技巧和知识点,很有用的。

2011-11-06

linux常用的一些命令(chm格式)

chm格式的linux系统常用的一些命令,对初学者有很大的帮助

2011-08-11

linux内核设计的艺术(第四章)

主要讲解linux操作系统的内核设计,挺不错的一本书

2011-08-11

mysql参考文档MySQL是一个真正的多用户

MySQL是一个真正的多用户、多线程SQL数据库服务器。SQL(结构化查询语言)是世界上最流行的和标准化的数据库语言。MySQL是以一个客户机/服务器结构的实现,它由一个服务器守护程序mysqld和很多不同的客户程序和库组成。

2011-01-22

空空如也

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

TA关注的人

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