自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 剑指Offer-面试题22:栈的压入、弹出序列

题面:《剑指Offer》P134 / 牛客网输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序。假设压入栈的所有数字均不相等。例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序列对应的一个弹出序列,但4,3,5,1,2就不可能是该压栈序列的弹出序列。分析清楚两个序列的关系问题就能迎刃而解方法1第一个弹出栈的位置无

2016-06-30 18:46:38 833

原创 微软2016校园招聘4月:hihocoder- #1290 : Demo Day

http://hihocoder.com/problemset/problem/1290?sid=811882#1290 : Demo Day时间限制:10000ms单点时限:1000ms内存限制:256MB描述You work as an intern at a robotics startup. Today i

2016-06-29 20:41:24 534

原创 LeetCode-130.Surrounded Regions

https://leetcode.com/problems/surrounded-regions/Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in tha

2016-06-28 15:43:46 433

原创 剑指Offer-面试题12:打印1到最大的n位数

题面:输入数字n,按顺序打印出从1到最大的n位十进制数。比如n=3,则打印输出1,2,3....999如果n比较小,可以很容易得到下面的代码void Print1ToMaxOfNDigits(int n){ int i = 0,max = 1; while (i++ < n) max *= 10; for (i = 1; i < max; i++)}但是当n比

2016-06-27 13:55:31 417

原创 LeetCode-106.Construct Binary Tree from Inorder and Postorder Traversal

https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that

2016-06-26 22:03:23 336

原创 LeetCode-105.Construct Binary Tree from Preorder and Inorder Traversal

https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that d

2016-06-26 21:48:00 379

原创 LeetCode-50.Pow(x, n)

https://leetcode.com/problems/powx-n/Implement pow(x, n).必须考虑各种越界问题参考 http://blog.csdn.net/linhuanmars/article/details/20092829#define DBL_MAX 1.7976931348623158e+308class Solution {publi

2016-06-26 16:14:58 402

原创 腾讯2017暑期实习生编程题-字符移位

测试链接 http://www.nowcoder.com/profile/8851694/test/3538973/44803小Q最近遇到了一个难题:把一个字符串的大写字母放到字符串的后面,各个字符的相对位置不变,且不能申请额外的空间。你能帮帮小Q吗?输入描述:输入数据有多组,每组包含一个字符串s,且保证:1<=s.length<=1000.

2016-06-22 20:52:34 1353

原创 腾讯2017暑期实习生编程题-构造回文

测试链接 http://www.nowcoder.com/questionTerminal/28c1dc06bc9b4afd957b01acdf046e69给定一个字符串s,你可以从中删除一些字符,使得剩下的串是一个回文串。如何删除才能使得回文串最长呢?输出需要删除的字符个数。输入描述:输入数据有多组,每组包含一个字符串s,且保证:1<=s.length<=1000.

2016-06-22 20:47:43 1610

原创 百度2017暑期实习生编程题-页面调度算法

测试链接 http://www.nowcoder.com/question/next?pid=1725826&qid=44807&tid=3554159在计算机中,页式虚拟存储器实现的一个难点是设计页面调度(置换)算法。其中一种实现方式是FIFO算法。FIFO算法根据页面进入内存的时间先后选择淘汰页面,先进入内存的页面先淘汰,后进入内存的后淘汰。假设Cache的大小为2,有5个

2016-06-22 12:32:33 778

原创 二叉搜索树(BST)的创建、插入、查找和删除

树的结构体定义struct TreeNode{ int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {}};插入因为二叉搜索树不允许存在相等的值,所以插入有可能失败非递归版bool BSTInsert(TreeNode* &root

2016-06-21 15:48:49 9797 2

原创 LeetCode-338.Counting Bits

https://leetcode.com/problems/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

2016-06-20 15:54:23 275

原创 LeetCode-187.Repeated DNA Sequences

https://leetcode.com/problems/repeated-dna-sequences/All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes u

2016-06-19 22:35:10 374

原创 LeetCode-343.Integer Break

https://leetcode.com/problems/integer-break/Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro

2016-06-19 15:34:59 276

原创 LeetCode-41.First Missing Positive

https://leetcode.com/problems/first-missing-positive/Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.

2016-06-18 22:52:35 338

原创 KMP模式匹配算法C++实现

void getNext(string s, int *next){ int n = s.length(), i = 0, j = -1; next[0] = -1; while (i < n-1) { if (j == -1 || s[i] == s[j]) next[++i] = ++j; else j = next[j]; }}int kmp(strin

2016-06-18 21:35:44 476

原创 LeetCode-335.Self Crossing

https://leetcode.com/problems/self-crossing/You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the north, then x[1] metres to the west, x[2] me

2016-06-18 13:33:11 553

原创 LeetCode-289.Game of Life

https://leetcode.com/problems/game-of-life/According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John

2016-06-17 21:26:33 669

原创 LeetCode-334.Increasing Triplet Subsequence

https://leetcode.com/problems/increasing-triplet-subsequence/Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.Formally the function sho

2016-06-17 13:13:33 620

原创 LeetCode-322.Coin Change

https://leetcode.com/problems/coin-change/You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need

2016-06-16 21:47:01 388

原创 LeetCode-319.Bulb Switcher

https://leetcode.com/problems/bulb-switcher/There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every

2016-06-15 21:45:55 380

原创 LeetCode-8.String to Integer (atoi)

https://leetcode.com/problems/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 no

2016-06-15 15:47:58 280

原创 LeetCode-165.Compare Version Numbers

https://leetcode.com/problems/compare-version-numbers/Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.

2016-06-15 15:15:42 278

原创 LeetCode-189.Rotate Array

https://leetcode.com/problems/rotate-array/Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].

2016-06-14 22:09:46 274

原创 LeetCode-278.First Bad Version

https://leetcode.com/problems/first-bad-version/You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quali

2016-06-14 17:22:58 234

原创 LeetCode-155.Min Stack

https://leetcode.com/problems/min-stack/Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes

2016-06-14 14:46:09 267

原创 LeetCode-190.Reverse Bits

https://leetcode.com/problems/reverse-bits/Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), ret

2016-06-14 12:39:41 358

原创 LeetCode-172.Factorial Trailing Zeroes

https://leetcode.com/problems/factorial-trailing-zeroes/Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.比较笨的办法,就

2016-06-14 11:24:22 215

原创 LeetCode-225.Implement Stack using Queues

https://leetcode.com/problems/implement-stack-using-queues/Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top

2016-06-14 10:50:28 274

原创 LeetCode-232.Implement Queue using Stacks

https://leetcode.com/problems/implement-queue-using-stacks/Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the elem

2016-06-13 22:25:04 299

原创 LeetCode-345.Reverse Vowels of a String

https://leetcode.com/problems/reverse-vowels-of-a-string/Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle".

2016-06-13 21:29:35 389

原创 LeetCode-326.Power of Three

https://leetcode.com/problems/power-of-three/Given an integer, write a function to determine if it is a power of three.Follow up:Could you do it without using any loop / recursion?方法1

2016-06-13 18:57:10 355

原创 LeetCode-191.Number of 1 Bits

https://leetcode.com/problems/number-of-1-bits/Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the

2016-06-13 16:23:00 638

原创 LeetCode-13.Roman to Integer

https://leetcode.com/problems/roman-to-integer/Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.首先查询罗马数字的规则:http://baike.baid

2016-06-13 15:55:55 268

原创 LeetCode-171.Excel Sheet Column Number

https://leetcode.com/problems/excel-sheet-column-number/Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.

2016-06-13 13:56:59 285

原创 LeetCode-168.Excel Sheet Column Title

https://leetcode.com/problems/excel-sheet-column-title/Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -

2016-06-13 13:42:06 295

原创 LeetCode-349&350.Intersection of Two Arrays

https://leetcode.com/problems/intersection-of-two-arrays/Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].

2016-06-13 11:17:54 525

原创 LeetCode-258.Add Digits

https://leetcode.com/problems/add-digits/Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is

2016-06-12 22:47:56 257

原创 LeetCode-169&229.Majority Element

https://leetcode.com/problems/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.You may assume

2016-06-12 18:12:29 277

原创 LeetCode-274&275.H-Index

https://leetcode.com/problems/h-index/Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to

2016-06-12 11:07:23 347

JPEG压缩神器

【摄友Hold住!JPEG压缩神器】以色列科技公司ICTV开发出的一种能够优化JPEG压缩的方法。软件自动分析一张照片在对画质不产生可见损失前提下可用的最大压缩率。ICTV称该方法预计可以将照片体积缩小50%-80%。

2014-12-16

WP8 下载网络音频到独立存储空间中播放示例

代码详解: http://blog.csdn.net/zmq570235977/article/details/20702729

2014-03-07

PDFEdit编辑器

推荐一个很好用的PDF编辑器程序可以帮助您有效地编辑PDF文件!它是世界上最好的和最好用的PDF编辑软件,很容易的即时编辑PDF文件。现在,您可以有效地使用的PDF编辑器程序以你自己的意愿读取和写入PDF格式文本,内容,图片,图片。 但是网上的版本打开时会有未注册的对话框,并且编辑过后的PDF文档每一页的右上角会带上"由Foxit PDF Editor 编辑 版权所有(c) by Foxit Software Company,2003-2009 仅用于评估"的红色标记. 这是我修改后的版本,去掉了未注册的对话框和标记

2012-10-06

空空如也

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

TA关注的人

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