自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 python csv 读取两种方法

1、pandas 的 read_csv读取的文件会保持原始文件的数据类型,如果csv文件中对应的字段是int类型,那么读取出来的元素就是int类型,如果是str类型,那么读取出来的元素就是str类型。2、DictReader读取的全部当成是string类型经验:在读取文件内容的程序中,read_csv和DictReader一定不能混用,不然可能会带来一些隐蔽的bug,由于数据类型的

2017-04-28 10:14:38 1109 1

原创 新的开始

一个月已经过去了,这个月总的来说过得很辛苦,自己挖的坑,自己选的路都需要自己来填。腾讯,阿里,等等各家大厂的面试也都告一段落了,不管结果好坏,自己都要去接受。偶然机会听面试官说写博客是自己知识的积累与分享过程,想想这个月学到的东西大多记在了印象笔记中。。。。所以决定从今天开始,每天抽半小时到一小时时间对每天学习的东西总结到博客中,一是方便自己复习总结,另外一个可以共享,毕竟自己也看了那么多别人

2017-04-28 10:06:41 266

原创 美团点评面试有感

下午从西边千里迢迢跑到东边去面试,总体感觉就是两个字:挂了。整个流程下来,对自己也是挺失望的,但失望中却又萌生出一种强烈的学习欲望,从今年开学以来,对机器学习进行了一次知识上的突击,很多时候,都只是满足于自己看懂某些公式,会推导某些公式。但今天面试的时候,面试官很多时候都会问一些细节的东西,这些东西都是需要去积累的。并且自己对几个经典模型的推导还没有滚瓜烂熟,很多算法只知表面原理是不够的。所以,我

2017-03-21 19:59:32 1381

原创 windows下xgboost 安装教程

xgboost是TianqiChen实现的一个boost算法(详细介绍参见http://xgboost.readthedocs.io/en/latest/),反正就是非常牛逼,诞生之后就获奖无数,引万千程序员为其疯狂。      但是,在windows版中的python中安装xgboost却是一件令人头疼的事情,反正我花了整整一天安装成功(哎。。)为了让后人不再重蹈覆辙,我就将我的安装经历整理

2016-12-01 14:04:22 528

转载 Logistic回归总结

Logistic回归总结文章来源:http://blog.csdn.net/dongtingzhizi/article/details/159627971.引言看了Stanford的Andrew Ng老师的机器学习公开课中关于Logistic Regression的讲解,然后又看了《机器学习实战》中的LogisticRegression部分,写下此篇学习笔记总结一下。首先说

2016-10-19 09:35:38 286

原创 Number of Digit One

Number of Digit OneGiven an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Return 6, because digit 1 o

2016-09-05 21:12:09 246

原创 Surrounded Regions

Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,X X X

2016-08-23 16:00:47 185

原创 Search for a Range

search for a rangeGiven 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

2016-08-18 11:32:57 211

原创 sort colors

Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0,

2016-08-17 10:35:18 450

原创 x&(x-1)

刷leetcode的时候,发现了很多使用到x&(x-1)的题目。顺便在网上查了查,做了总结:求下面函数的返回值(微软) -- 统计1的个数-------------------------------------int func(int x){    int countx = 0;    while(x)    {        countx++;

2016-07-16 11:42:32 262

原创 Lowest Common Ancestor of a Binary Tree

Lowest Common Ancestor of a Binary TreeGiven a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest

2016-05-28 13:40:47 168

原创 Gas Station

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

2016-05-26 10:44:14 397

原创 lambda 函数在C++中的用法

C++11 新增了很多特性,lambda 表达式是其中之一,如果你想了解的 C++11 完整特性,建议去这里,这里,这里,还有这里看看。本文作为 5 月的最后一篇博客,将介绍 C++11 的 lambda 表达式。很多语言都提供了 lambda 表达式,如 Python,Java 8。lambda 表达式可以方便地构造匿名函数,如果你的代码里面存在大量的小函数,而这些函数一般只被调用一次,

2016-05-24 22:22:10 406

原创 Top K Frequent Elements

Top K Frequent ElementsGiven a non-empty array of integers, return the k most frequent elements.For example,Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may

2016-05-24 22:19:59 230

转载 Python 的内置字符串方法

字符串处理是非常常用的技能,但 Python 内置字符串方法太多,常常遗忘,为了便于快速参考,特地依据 Python 3.5.1 给每个内置方法写了示例并进行了归类,便于大家索引。PS: 可以点击概览内的绿色标题进入相应分类或者通过右侧边栏文章目录快速索引相应方法。概览字符串大小写转换str.capitalize()str.lower()str.casefold()str.

2016-05-23 16:30:12 442

转载 双端队列(Deque)

双端队列(Deque),是一种类似于队列的元素的有序集合。它拥有两端,队首和队尾,并且元素保持在当前的位置。双端队列的一个不同点就是,添加和删除元素的位置不受限制。新元素可以在队首或者队尾添加。同样地,双端队列中的元素可以从两端弹出。在某种意义上,这种混合的线性结构同时具有栈和队列的性质。很重要的一点,即使双端队列具有栈和队列的特性,但它不会被强制执行的LIFO和FIFO操作。这取决于你做

2016-05-23 16:27:23 1217

转载 网易考拉2017暑假实习生招聘笔试题(网络问题)

一条tcp连接,主动关闭的一方不可能出现的连接状态为( CLOSE_WAIT  ) CLOSE_WAIT FIN_WAIT2TIME_WAIT FIN_WAIT1介绍一下TCP连接建立与关闭过程中的状态。TCP连接过程是状态的转换,促使状态发生转换的因素包括用户调用、特定数据包以及超时等,具体状态如下所示:CLOSED :初始状态,表示没有任何连接。LISTEN

2016-05-23 15:43:49 1146

原创 Group Anagrams

Group AnagramsGiven an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","

2016-05-21 17:02:43 507

原创 Construct Binary Tree from Preorder and Inorder Traversal

Construct Binary Tree from Preorder and Inorder TraversalGiven preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not

2016-05-21 16:34:40 178

原创 Kth Smallest Element in a BST

Kth Smallest Element in a BSTGiven a binary search tree, write a function kthSmallest to find thekth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤

2016-05-20 16:00:58 205

原创 阿里巴巴2017笔试题

如下一道选择题:int main(){int* pint = 0;pint += 6;cout << pint << endl;}主要考虑到内存空间的分配问题,开始很容易被int* pint = 0;这句话误解,这句话的意思并不是给整数赋值,而是给地址分配一个新的值,所pint的初始地址是0x00,由于int型地址的最小单位是4位。对整型的地址进行运算,则每一次加一都是加4位。所

2016-05-20 10:59:13 728

原创 Python map reduce

map()和reduce(): 二者都是高阶函数。map()接收两个参数,一个是函数,一个是Iterable序列,map将传入的函数依次作用在序列每一个元素上,并把结果作为新的Iterator返回。reduce()类似累积计算版的map(),把一个函数作用在一个序列上,每次接收两个参数,将结果继续与序列的下一个元素做累积计算。利用map和reduce编写一个str2float函数,如把字符串'

2016-05-19 21:58:28 343

原创 Permutations II

Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[1,1,2], [1,2,1], and [2,1,1].

2016-05-19 19:05:45 171

原创 Python中装饰器

用学到的新知识,可以写一个记录函数参数的装饰器。为简单起见,仅打印到标准输出:>>> def logger(func):... def inner(*args, **kwargs): #1... print "Arguments were: %s, %s" % (args, kwargs)... return func(*args, **kwarg

2016-05-19 11:08:51 215

原创 Permutations

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], and [3,2,1].看完一遍题

2016-05-18 19:57:27 177

原创 Single Number II

Single Number IIGiven an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity

2016-05-17 22:01:06 337

原创 Power of two,power of three,power of four

Power of TwoTotal Accepted: 3596 Total Submissions: 11779Given an integer, write a function to determine if it is a power of two.Credits:Special thanks to @jianchao.li.fighter for addi

2016-05-17 20:23:13 222

原创 Majority Element

class Solution {public: vector majorityElement(vector& nums) { if(nums.size() == 0) return nums; sort(nums.begin(),nums.end()); vector result; int temp

2016-05-16 22:41:52 164

原创 Counting Bits

Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example:For num = 5 y

2016-05-16 22:08:07 209

空空如也

空空如也

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

TA关注的人

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