自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

代码菌的blog

Just for fun

  • 博客(21)
  • 资源 (3)
  • 收藏
  • 关注

原创 关于二叉树的一道面试题

刚看到一个题:给一个string of nested ternary operations例如a?b?c:d:e,build a tree:root是a,左子树是b?c:d对应的tree ,右子树是e。保证input都是valid的。嗯,先给自己挖个坑,暂时没空,先放着,感兴趣的也可以自己做一做(2015/1/27)

2015-01-27 18:41:17 782

原创 LeetCode119——Pascal's Triangle II

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 space?题目大意给定一个索引k,

2015-01-27 18:15:05 1201

原创 LeetCode125——Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a p

2015-01-27 18:05:48 3342

原创 LeetCode14——Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.题目大意写一个函数来找出所有字符串里最长的公共前缀。难度系数:容易实现题目不难,基本思路大家都能想到,就是一些细节可能会遗漏。这个也没啥好算法,不管怎样,都需要一个个去比较。 所以没啥好说

2015-01-27 17:58:51 784

原创 LeetCode13——Roman to Integer

Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.题目大意给你个罗马数字,把它转换成一个int数。输入限定在[1, 3999]。难度系数:容易实现一次性通过,:)int getVal(c

2015-01-27 17:51:09 3029 3

原创 LeetCode9——Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.题目大意判断一个int是否为回文数,不使用额外的储存空间。难度系数:容易实现int getfactor(int x) { if (x < 10) return 1; int facto

2015-01-27 10:26:54 3148 2

原创 LeetCode8——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-01-26 18:06:22 1094

原创 LeetCode7——Reverse Integer

Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321大意反转int的数字。难度系数: 容易实现易错点是没有做溢出检查。后来我看了下网上的答案,写的比我好很多(好惭愧)。所以这题就给出个网上的答案吧。int reverse(i

2015-01-26 11:21:12 3462 1

原创 LeetCode6——ZigZag Conversion

The 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)P A H NA P L S I I

2015-01-23 15:17:07 877

原创 LeetCode155——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 the element on top of the stack.top() -- Get

2015-01-23 11:06:55 1253

原创 LeetCode160——Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘

2015-01-21 10:46:53 1282

原创 c++ const成员函数的纠结

const的美妙在于它能让你规定一个语义上的常量。应该尽可能地在代码中使用它,全局作用域,命名空间内,类里面都可以使用, 不管是静态还是非静态的对象,你都可以使用它。一个const对象,它只能调用const函数。因为非const函数,可能会修改这个对象。因此,如果一个成员函数,它不会修改任何非static 成员数据,你应该声明为const。比如:class String {

2015-01-19 20:34:08 1140 2

原创 LeetCode165——Compare Version Numbers

题目Compare two version numbers version1 and version1.If version1 > version2 return 1, if version1 You may assume that the version strings are non-empty and contain only digits and the . cha

2015-01-16 15:43:12 3621

原创 LeetCode168——Excel Sheet Column Title

LeetCode168——Excel Sheet Column Title题目Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example:1 -> A2 -> B3 -> C...26 -> Z27 -> AA2

2015-01-15 13:59:34 1243

原创 LeetCode169——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 that the array is non-empty and the majority element al

2015-01-15 11:11:26 7092

原创 LeetCode171——Excel Sheet Column Number

题目Given a column title as appear in an Excel sheet, return its corresponding column number.For example:A -> 1B -> 2C -> 3...Z -> 26AA -> 27AB -> 28 Credits: Special thanks to @ts f

2015-01-14 17:07:17 1040

原创 LeetCode88——Merge Sorted Array

题目Given two sorted integer arrays A and B, merge B into A as one sorted array.Note: You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements

2015-01-14 16:10:41 2063

原创 LeetCode20——Valid Parentheses

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

2015-01-14 12:58:18 1181

原创 LeetCode112——Path Sum

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example: Given the below binary tree and sum

2015-01-13 18:34:45 4343 14

原创 LeetCode172——Factorial Trailing Zeroes

LeetCode172——Factorial Trailing ZeroesGiven an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.难度系数:容易题目大意:给定一个整数n,

2015-01-13 00:39:23 2809

原创 《观止——微软创建NT和未来的夺命狂奔》读后感

这是一本书讲述了NT的创建过程,戴夫卡特勒无疑是主角,被称为是“操作系统天神”。然而他并非从小就开始编程,甚至毕业开始工作时对计算机一窍不通。只是他的数学很棒,有人让他去通用汽车公司做计算机编程,结果被他拒绝了,他认为计算机很危险,甚至不吉祥。最后他去了杜邦公司。他在杜邦的工作需要用到计算机,于是去IBM开办的学校呆了一周,他学会了给IBM电脑编写程序。回到杜邦公司后,他对编程的兴趣越来越大。最后

2015-01-06 18:45:26 3039

csv大文件打开器

csv大文件打开器

2013-11-06

OpenGL(全)

OpenGL库文件大全

2012-05-04

空空如也

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

TA关注的人

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