自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 正则表达式

正则表达式对应表

2016-07-15 14:14:11 270

原创 统计字符个数

问题描述输入一行字符,分别统计出其中英文字母,数字,空格,其它字符的个数。

2016-07-15 13:47:50 447

原创 两数之和

题目描述给定一个数组,找到两个数,使得他们的和为一个给定的数值target。

2016-07-15 10:28:29 303

原创 for循环打印字典

代码实现bat = {'a': 'alibaba', 'b': 'baidu', 't': 'tencent'}for value in bat.values(): print valuefor key in bat: print keyfor k,v in bat.items(): print k, '>', v

2016-07-14 19:13:29 1106

原创 查看字典元素

代码实现bat = {'a': 'alibaba', 'b': 'baidu', 't': 'tencent'}print bat.keys()#取键名print bat.values()#取键值print bat.items()#取键值对

2016-07-14 19:08:41 444

原创 交叉排序

题目描述输入一行 k 个用空格分隔开的整数,依次为 n1, n2 … nk。请将所有下标不能被 3 但可以被 2 整除的数在这些数字原有的位置上进行升序排列,此外,将余下下标能被 3 整除的数在这些数字原有的位置上进行降序排列。

2016-07-14 18:04:36 298

原创 非递归方法求斐波那契数列的第n项

问题描述第一项为0 第二项为1 ….. 第n项为前两项之和

2016-07-13 12:40:20 2815

原创 列表的添加、插入、删除、切割、合成

python列表对于字符串的一些操作

2016-07-13 10:10:38 215

原创 字符串的格式化

python中字符串的格式化

2016-07-12 17:42:04 210

原创 Python的find()

find()函数find()函数会在原字符串中查找参数传入的子字符串,如果没有找到请求的字符串就会返回-1,否则返回找到的子字符串的第一个字符在原字符串中的索引位置。

2016-07-12 17:30:32 727

原创 Python的字符串测试

python中字符串的测试方法

2016-07-12 16:46:28 282

原创 用Python求A+B+C

问题描述输入为一行,包括用空格分隔的三个整数,分别为 A、B、C(数据范围均在 -40 ~ 40 之间)。输出为一行,为“A+B+C”的计算结果。代码实现sum = 0

2016-07-12 16:16:38 5412

原创 用Python实现斐波拉契数列

问题描述著名的斐波拉契数列(Fibonacci),除第一个和第二个数外,任意一个数都可由前两个数相加得到:1, 1, 2, 3, 5, 8, 13, 21, 34, …

2016-07-08 15:08:51 1675

原创 用Python递归实现汉诺塔问题

问题描述汉诺塔(又称河内塔)问题是源于印度一个古老传说的益智玩具。大梵天创造世界的时候做了三根金刚石柱子,在一根柱子上从下往上按照大小顺序摞着64片黄金圆盘。大梵天命令婆罗门把圆盘从下面开始按大小顺序重新摆放在另一根柱子上。并且规定,在小圆盘上不能放大圆盘,在三根柱子之间一次只能移动一个圆盘。

2016-07-07 20:24:38 2562

原创 【leetcode】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?

2016-06-08 12:34:02 187

原创 【leetcode】Power of Three

Given an integer, write a function to determine if it is a power of three.

2016-06-02 13:46:41 190

原创 【leetcode】Intersection of Two Arrays II

Given two arrays, write a function to compute their intersection.

2016-06-01 19:40:06 178

原创 【leetcode】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.

2016-06-01 16:01:28 182

原创 【leetcode】Excel Sheet Column Number

Given a column title as appear in an Excel sheet, return its corresponding column number.

2016-06-01 15:36:24 176

原创 【leetcode】Valid Anagram

Given two strings s and t, write a function to determine if t is an anagram of s.

2016-06-01 10:32:56 176

原创 【leetcode】Move Zeroes

Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.

2016-05-31 20:23:29 188

原创 【leetcode】Intersection of Two Arrays

Given two arrays, write a function to compute their intersection.

2016-05-31 15:53:09 228

原创 环形队列的C++实现

环形队列的C++实现

2016-05-25 17:08:45 1833

原创 【Leetcode】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.

2016-05-25 13:28:59 164

原创 【Leetcode】Number of 1 Bits(easy)

QuestionWrite a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).

2016-05-19 20:07:37 162

原创 【Leetcode】Add Digits(easy)

QuestionGiven a non-negative integer num, repeatedly add all its digits until the result has only one digit.

2016-05-19 19:19:07 154

原创 【Leetcode】Reverse String(easy)

QuestionWrite a function that takes a string as input and returns the string reversed.

2016-05-19 15:27:35 168

原创 【Leetcode】Reverse Integer(easy)

Question:Reverse digits of an integer.

2016-05-19 14:11:38 181

原创 C++11——关联容器类型

标准库提供8个关联容器,这8个容器间的不同体现在三个维度上

2016-05-19 11:10:09 522

原创 【Leetcode】Two sum(easy)

QuestionGiven an array of integers, return indices of the two numbers such that they add up to a specific target.

2016-05-18 19:34:10 241

原创 欲写好一个类,必先将其解剖(类外定义)

类外定义的书写

2016-05-04 13:34:58 281

原创 欲写好一个类,必先将其解剖(数据的封装)

数据的封装

2016-05-03 16:55:33 202

原创 汽水瓶

题目描述有这样一道智力题:“某商店规定:三个空汽水瓶可以换一瓶汽水。小张手上有十个空汽水瓶,她最多可以换多少瓶汽水喝?”

2016-05-03 14:47:26 246

原创 欲写好一个类,必先将其解剖(类和对象)

C++最重要的特点是面向对象,而面向对象的核心使用类实现的,而类中又包括了数据成员和成员函数。

2016-05-03 12:57:38 248

原创 使用map关联容器

前言关联容器支持高效的关键字查找和访问。两个主要的关联容器类型是map和set。

2016-04-30 12:49:10 285

原创 合并表记录(map)

题目描述数据表记录包含表索引和数值,请对表索引相同的记录进行合并,即将相同索引的数值进行求和运算,输出按照key值升序进行输出。

2016-04-28 16:13:20 329

原创 句子逆序(stringstream实现)

题目描述将一个英文语句以单词为单位逆序排放。

2016-04-28 15:59:01 580

原创 标准库类型vector

标准库类型vector

2016-04-28 13:13:09 219

原创 字串的连接最长路径查找(sort函数实现)

题目描述给定n个字符串,请对n个字符串按照字典序排列。

2016-04-27 21:52:56 325

原创 标准库类型string

标准库类型string

2016-04-27 21:28:05 179

空空如也

空空如也

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

TA关注的人

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