自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(45)
  • 资源 (3)
  • 收藏
  • 关注

原创 编程之美2015资格赛 - 题目1 : 2月29日

时间限制:2000ms单点时限:1000ms内存限制:256MB描述给定两个日期,计算这两个日期之间有多少个2月29日(包括起始日期)。只有闰年有2月29日,满足以下一个条件的年份为闰年:1. 年份能被4整除但不能被100整除2. 年份能被400整除输入第一行为一个整数T,表示数据组数。之后每组数据包含两行。每一行格式为"mont

2015-04-17 16:56:44 718 3

原创 leetcode 18 4Sum

4SumGiven an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:

2015-04-14 18:24:25 356

原创 leetcode 25 Reverse Nodes in k-Group

Reverse Nodes in k-GroupGiven 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 i

2015-04-14 16:32:37 316

原创 leetcode 24 Swap Nodes in Pairs

Swap Nodes in Pairs 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 sho

2015-04-14 15:32:24 331

原创 leetcode 30 Substring with Concatenation of All Words

Substring with Concatenation of All WordsYou are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenat

2015-04-13 16:29:44 406

原创 leetcode 29 Divide Two Integers

Divide Two Integers Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.class Solution1: # @return an integer def divi

2015-04-13 16:07:41 316

原创 leetcode 28 Implement strStr()

Implement strStr()Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.要注意特殊情况,比如strstr("","") 应该等于0 =_=class

2015-04-13 15:46:09 241

原创 leetcode 27 Remove Element

Remove Element Given 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 what you leave be

2015-04-13 15:23:05 331

原创 leetcode 26 Remove Duplicates from Sorted Array

Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for

2015-04-13 15:14:01 430

原创 leetcode 23 Merge k Sorted Lists

Merge k Sorted ListsMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.可以通过leetcode 21的merge Two Lists来解决。如果从头到尾依此合并,会超时。改用分治法来调用。链表个数l>3时,

2015-04-12 17:09:48 397

原创 leetcode 22 Generate Parentheses

Generate Parentheses Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()

2015-04-12 16:45:12 319

原创 leetcode 21 Merge Two Sorted Lists

Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.# Definition for sin

2015-04-12 16:09:18 311

原创 leetcode 20 Valid Parentheses

Valid ParenthesesGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()"

2015-04-12 15:53:18 310

原创 leetcode 19 Remove Nth Node From End of List

Remove Nth Node From End of List Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After

2015-04-12 15:05:59 368

原创 leetcode 17 Letter Combinations of a Phone Number

Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone

2015-04-12 14:32:27 350

原创 leetcode 16 3Sum Closest

3Sum ClosestGiven an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each inpu

2015-04-12 13:51:33 299

原创 leetcode 15 3Sum

3SumGiven 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 tr

2015-04-08 17:26:11 400

原创 leetcode 14 Longest Common Prefix

Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.需要注意的特殊情况:输入是个空列表import unittestclass Solution: # @return a string def l

2015-04-08 11:17:20 352

原创 leetcode 13 Roman to Integer

Roman to IntegerGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.从字符串中每次处理一位,处理前需要先找到剩余串的枢纽(剩余串中最大的),以判断当前值在其左边还是右边,该相加还是相减。i

2015-04-08 10:57:06 334

原创 leetcode 12 Integer to Roman

数字转换为罗马数字

2015-04-07 19:11:24 320

原创 leetcode 11 Container With Most Water

Container With Most WaterGiven 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 lin

2015-04-07 17:42:27 283

原创 leetcode 10 Regular Expression Matching & 44 Wildcard Matching

leetcode中的两个 正则表达式匹配

2015-03-26 14:44:30 496

转载 pdb

使用pdb调试https://docs.python.org/2/library/pdb.htmlindexmodules |next |previous | Python » dev (3.5)3.43.33.22.7.92.6 Documentation » The Python Standard Library » 26. Debugging and Prof

2015-03-25 10:01:51 551

原创 leetcode 9 Palindrome Number

Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If yo

2015-03-20 17:23:19 284

原创 leetcode 8 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-03-20 17:03:29 294

原创 leetcode 7 Reverse digits of an integer

Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321class Solution: # @return an integer def reverse(self, x): tmp=abs(x) if tm

2015-03-20 16:38:57 330

原创 leetcode 6 ZigZag Conversion

ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)

2015-03-20 16:16:43 255

原创 leetcode 5 Longest Palindromic Substring

Longest Palindromic SubstringGiven a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindrom

2015-03-19 18:03:14 275

原创 leetcode 4 Median of Two Sorted Arrays

Median of Two Sorted ArraysThere are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).

2015-03-19 14:57:32 366

原创 leetcode 3 Longest Substring Without Repeating Characters

Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters

2015-03-18 15:29:27 304

原创 leetcode 1 Two Sum

Two SumGiven 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 that they add up to th

2015-03-18 15:24:16 300

原创 calloc=malloc+memset?

功能上calloc=malloc+memset;从汇编指令来看的话,calloc的指令是malloc+memset的一半左右。时间上来说,calloc节省时间用oProfile测试,重复10000000次,使用CPU cycle为(不用看绝对,相对比较就好)   16.3547 :                        c=calloc(100,i);   8.0788

2015-01-21 11:30:54 608

转载 Python打印颜色

格式:\033[显示方式;前景色;背景色m 说明:前景色            背景色           颜色---------------------------------------30                40              黑色31                41              红色32                4

2014-11-24 13:41:44 357

转载 linux下的依赖包

在某台内网服务器上安装Oprofile,但是提示确实liberty库,安装liberty库,又ti

2014-10-27 17:28:35 979

原创 1.10 找经过点最多的直线

1.10 Given a two dimensional graph with 6000 points on it, find a line which passes the most number of points.

2014-10-26 11:17:31 388

原创 1.9 最高的 身高体重从上到下依此递增的塔

1.9 A circus is designing a tower routine consisting of people standing atop one another’sshoulders. For practical and aesthetic reasons, each person must be both shorter andlighter than the perso

2014-10-24 16:02:11 553

原创 1.8 找到只含3,5,7因子的第k大的数

1.8 Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7.

2014-10-24 15:37:04 868

转载 1.7 用加法实现乘除减运算

1. 7 Write a method to implement *, - , / operations. You should use only the + operator.直接t

2014-10-24 15:32:09 408

原创 1.6 不用算术符号实现加法

1. 6 Write a function that adds two numbers. You should not use + or any arithmetic operators.一看就是

2014-10-24 15:14:39 510

原创 1.5 计算阶乘末尾0的个数

1.5 Write an algorithm which computes the number of trailing zeros in n factorial.EXAMPLEinput: 11output: 2 (11! = 39916800)m

2014-10-17 18:03:56 591

从0到n,共包含多少个2?

cc150 1.2 从0到n,共包含多少个2?代码

2014-10-15

英语完型填空常考固定词组

英语 完型填空 固定词组 英语完型填空常考固定词组打印版

2011-11-13

英语写作常用谚语100句

英语写作常用谚语100句 这个是英语写作常用谚语100句,对英语写作有帮助.

2011-11-13

空空如也

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

TA关注的人

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