自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 资源 (1)
  • 收藏
  • 关注

原创 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. The one who removes the last stone will be the

2016-04-12 22:08:41 306

原创 Range Sum Query - Immutable(accepted版本)

在discuss里看到一位存在的算法,他的算法里的思想为我打开了另一扇门,传送门聪明人的解法.下面是我实现的C语言版本。呵呵,大家见笑啦!看来提交不能通过的问题,自己还没有深入思考,改之!#includestruct NumArray { int num;};/** Initialize your data structure here. */struct NumArra

2016-04-09 17:26:04 359

原创 Range Sum Query - Immutable

题目详细信息如下:Given an integer array nums, find the sum of the elements between indicesi and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5)

2016-04-09 16:23:37 370

原创 字符串转成整数大数乘法

今天看到的题如下所示:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.Subscribe to see which c

2016-04-07 23:38:19 624

原创 杨辉三角 空间复杂度O(k)

今天在leetcode上看到一题如下:Given 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 optimize your algorithm to use only O(k) extra spa

2016-04-06 22:40:48 800

原创 统计无符号整型数的二进制码中‘1’的个数

昨天在leetcode上看到一道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 the

2016-04-06 10:00:13 571 1

原创 由外向内生成N*N矩阵

前两天在线笔试时的一道题,生成一个N为的矩阵,形式如下N=3 1  2  3 8  9  4 7  6  5当时用下面的方法去写 结果总是出错,也不能debug,最终没调出来。考完后重新调了一下 不过觉得应该有更好的算法才对,可是想不出来,请大家多多指教。#includevoid gen_matrix(int n){ int i, j, tmp, count, arr[n][n]; i = j

2016-04-05 16:45:17 422

原创 求两个整数最大公约数的欧几里德算法和求幂运算程序

求两个数最大公约数的欧几里德算法:/**Author: gyh*Date: 201412227*Version: 1.0*/#includeint gcd(int a, int b);int main(void){ int a, b; printf("Entry two numbers: "); scanf("%d%d", &a, &b); printf(" %d and

2014-12-27 21:21:33 486

原创 最大子序列和问题的解

关于最大子序列和问题的四种解法的实现,关于代码中的注释有时间会补加,欢迎各位指点,交流。

2014-12-25 22:26:52 372

转载 Ubuntu14.04 英文版安装中文输入法

在英文版的Ubuntu14.04LTS系统上安装中文输入法过程:联网状态下执行以下命令(在非root下首次执行时需要输入root密码):sudo apt-get install ibus 安装ibus输入法框架;该框架通常系统已经自带不用安装,若没有可通过该命令安装。sudo apt-get install ibus-pinyin 安装pinyin输入法;给ibus输入法框架添

2014-12-16 13:39:28 1673

原创 第一章 引论

练习1.1  一个程序解决选择问题/* For selecting kth number from n numbers. *Author: gyh *Date: 20141214 *Version: 1.0 */#include void select(int n, int k){ int a[n]; printf("Enter %d numbers: ", n);

2014-12-15 16:39:49 397

Cocos2D文档

Cocos2D开发参考文档 Cocos2D帮助文档

2014-01-13

空空如也

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

TA关注的人

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