自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 批量文件编码转换-python

#!/usr/bin/python# coding=utf8import os,sysdef convert( filename, in_enc = "GBK", out_enc="UTF-8" ): try: tmp_filename = filename + ".tmp" convert_cmd = "iconv -f %s -t %s %s > %s"%(in_en

2014-05-06 21:05:14 613

原创 Add Two Numbers

Add Two Numbers AC Rate: 1268/5597My SubmissionsYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes c

2013-10-08 18:23:18 809

原创 Remove Element - leetcode

Remove Element My SubmissionsGiven an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter wha

2013-10-08 13:58:48 530

原创 Convert Sorted Array to Binary Search Tree - leetcode

Convert Sorted Array to Binary Search Tree My SubmissionsGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.思路: 利用数组有序,然后二分建立二叉查找树

2013-10-07 11:45:50 680

原创 == 的优先级比 & 高

== 的优先级比 & 高

2013-10-06 16:51:11 1280

原创 Pow(x, n) -leetcode

Pow(x, n) My SubmissionsImplement pow(x, n).class Solution {public: double pow(double x, int n) { // Note: The Solution object is instantiated only once and is reused by eac

2013-10-06 16:46:27 723

原创 Pascal's Triangle -leetcode

Pascal's Triangle AC Rate: 867/2595My SubmissionsGiven numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [

2013-10-05 20:50:39 672

原创 Pascal's Triangle II -leetcode

Pascal's Triangle II AC Rate: 739/2353My SubmissionsGiven an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you opt

2013-10-05 20:17:00 1211

原创 Reverse Integer -leetcode

Reverse Integer AC Rate: 1290/3061My SubmissionsReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thoug

2013-10-05 17:20:00 913

原创 [leetcode]-twoSum

Two Sum My SubmissionsGiven an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such tha

2013-10-04 13:07:30 617

原创 Divide Two Integers - leetcode

Divide Two Integers AC Rate: 551/3701My SubmissionsDivide two integers without using multiplication, division and mod operator.class Solution {public: int divide(int div

2013-10-04 12:13:36 643

原创 Single Number II - leetcode

Single Number II AC Rate: 11/62My SubmissionsGiven an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a

2013-10-03 15:38:57 2979 3

原创 Single Number - leetcode

Single NumberMy SubmissionsGiven an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. C

2013-10-03 14:05:41 1412

原创 Add Binary - leetcode

Add Binary My SubmissionsGiven two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".思路:模拟加法class Solution {public: string

2013-10-03 13:55:41 761

原创 LeetCode - Swap Nodes in Pairs

Problem :Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only cons

2013-10-03 12:28:19 621

原创 题目1512:用两个栈实现队列

题目描述:用两个栈来实现一个队列,完成队列的Push和Pop操作。队列中的元素为int类型。输入:每个输入文件包含一个测试样例。对于每个测试样例,第一行输入一个n(1接下来的n行,每行输入一个队列操作:1. PUSH X 向队列中push一个整数x(x>=0)2. POP 从队列中pop一个数。输出:对应每个测试案

2013-08-26 15:22:02 584

原创 2012 google校园招聘 笔试2.2

题目描述:给定字符串s,要求把s中的连续空格压缩成一个空格,并将连续的非空字符串倒序打印出来。例如,给定 “abc def efg”, 打印“cba def gfe”。      思路,这个题看似简单,但是要写正确确实很难。下面我给几个测试案例  (1):“***” , (2)“**abc**def” (3) "abc" (4) “abc **def**”上面为了方便看出空

2013-08-24 23:58:59 580

原创 2012 google校园笔试编程题2.1

题目描述:2.1 一个环,N个点,任意相邻两点有一个距离。要求写一个算法,输入为点i和点j,输出是他们之间的最短路径。某环形公路上有N个站点,分别记为A1,...,An,从Ai到A(i+1)的距离为Di,An到A1的距离为D0。假设D0~D(n-1)保存在数组D[N]中。现在要求你写一个函数,能够高效的计算出公路上任意两点的最近距离,要求空间复杂度不能超过O(N)。思路:用

2013-08-24 21:47:38 1357

原创 题目1511:从尾到头打印链表

题目描述:输入一个链表,从尾到头打印链表每个节点的值。输入:每个输入文件仅包含一组测试样例。每一组测试案例包含多行,每行一个大于0的整数,代表一个链表的节点。第一行是链表第一个节点的值,依次类推。当输入到-1时代表链表输入完毕。-1本身不属于链表。输出:对应每个测试案例,以从尾到头的顺序输出链表每个节点的值,每个值占一行。

2013-08-24 12:46:21 646

原创 题目1510:替换空格 jobdu

题目描述:请实现一个函数,将一个字符串中的空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。输入:每个输入文件仅包含一组测试样例。对于每组测试案例,输入一行代表要处理的字符串。输出:对应每个测试案例,出经过处理后的字符串。样例输入:We

2013-08-24 11:04:03 727

原创 题目1384:二维数组中的查找 --九度-online judge

题目描述:在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。输入:输入可能包含多个测试样例,对于每个测试案例,输入的第一行为两个整数m和n(1输入的第二行包括一个整数t(1接下来的m行,每行有n个数,代表题目所给出的m行n列的矩阵(矩阵如题目描述所示,每一

2013-08-24 10:37:08 896 3

原创 fibonacci 数列实现 log(n) and O(n)

简单实现了一个fibonacci数列的计算:定义:n = 0 , fn = 0; n = 1, fn = 1; n = 2, fn = fn-1 + fn-2; 第n项是前两项的和,即为fibonacci数列。0, 1, 1, 2,3, 5...#include #include using namespace std;template class fibonacci {

2013-07-10 22:52:43 689

转载 POI 读取word (word 2003 和 word 2007)

http://blog.csdn.net/hemingwang0902/article/details/4381598

2013-06-03 10:30:18 696

转载 自动获得access_token

http://wtm-mac.iteye.com/blog/1623074 https://github.com/wtmmac/Sina-weibo-api-access-by-pythonhttp://ar.newsmth.net/thread-a419e47b2d253b-2.html

2013-04-19 21:24:22 688

转载 python sina api token

http://blog.csdn.net/linjianfengqrh/article/details/7359325

2013-04-18 14:58:01 603

原创 twoSum

class Solution {public: struct pos { int val; int idx; bool operator < ( const struct pos & lhs) const{ return val < lhs.val; } pos(int v, int

2013-04-15 23:18:46 612

转载 windows 远程 python mysql

http://blog.csdn.net/maoweiwer/article/details/6553435https://pypi.python.org/pypi/MySQL-python/1.2.4      下载mysql-python

2013-04-11 14:17:42 638

转载 scikit-learn

http://blog.csdn.net/qujiangtao1986/article/details/8453621easy_install jieba

2013-04-09 15:26:07 946

转载 sublime text ubuntu 安装

http://www.technoreply.com/how-to-install-sublime-text-2-on-ubuntu-12-04-unity/

2013-04-03 12:34:30 634

转载 php 文件下载

http://www.cnblogs.com/ninelands/archive/2012/07/24/2606628.html

2013-03-29 22:13:00 568

转载 vim 配置

http://blog.csdn.net/luoweifeng1989/article/details/6610133

2013-03-28 14:27:50 500

转载 ubuntu+eclipse+pydev 记录

http://www.cnblogs.com/Realh/archive/2010/10/10/1847251.html

2013-03-28 14:06:45 569

原创 phpMyAdmin 安装记录

安装: http://www.piaoyi.org/php/phpMyAdmin-install-method-faqs.html缺少mysqli扩展看这里:http://www.work90.cn/post/237.html

2013-03-22 19:33:11 583

空空如也

空空如也

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

TA关注的人

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