- 博客(42)
- 资源 (4)
- 收藏
- 关注
转载 阅读《C陷阱与缺陷》的知识增量
这本书是在ASCI C/C89订制之前写的,有些地方有疏漏。第一章 词法陷阱1.3 C语言中解析符号时使用贪心策略,如x+++++y将被解析为x++ ++ +y,并编译出错。1.5 单引号引起的一个字符代表一个对应的整数,对于采用ASCII字符集的编译器而言,'a'与0141、97含义一致。练习1.1 嵌套注释(如/*/**/*/)只在某些C编译器中允许,如gcc4
2015-07-23 22:09:41
340
原创 LeetCode之旅(39)
Best Time to Buy and Sell Stock IISay you have an array for which the ith element is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete as
2014-09-04 19:55:15
422
原创 LeetCode之旅(38)
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 linei
2014-09-04 18:58:37
388
原创 LeetCode之旅(37)
Best Time to Buy and Sell StockSay you have an array for which the ith element is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie, buy
2014-09-02 21:52:08
350
原创 LeetCode之旅(36)
Pascal's TriangleGiven numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]
2014-09-02 20:52:25
375
原创 LeetCode之旅(35)
Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print t
2014-09-02 20:33:42
430
原创 LeetCode之旅(34)
3SumGiven an array S of n integers, are there elementsa, 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 trip
2014-09-01 16:59:29
383
原创 LeetCode之旅(33)
Linked List Cycle IIGiven a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?
2014-08-31 19:20:26
361
原创 LeetCode之旅(32)
Binary Tree Postorder TraversalGiven a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3
2014-08-31 17:35:39
326
原创 LeetCode之旅(31)
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the
2014-08-31 16:20:22
542
原创 LeetCode之旅(30)
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
2014-08-31 15:24:11
354
原创 LeetCode之旅(28)
Sort ColorsGiven an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will
2014-08-30 23:40:43
395
原创 LeetCode之旅(26)
Symmetric TreeGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4
2014-08-29 21:08:01
348
原创 LeetCode之旅(25)
Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonce and return the new length.Do not allocate extra space for ano
2014-08-29 19:33:19
435
原创 LeetCode之旅(24)
Swap Nodes in PairsGiven 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 should use
2014-08-29 18:56:14
377
原创 LeetCode之旅(23)
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.
2014-08-29 17:41:29
450
原创 LeetCode之旅(18)
Integer to RomanGiven an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.
2014-08-28 14:49:19
329
原创 LeetCode之旅(17)
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.很无聊的一道题,不过
2014-08-28 14:35:48
313
原创 LeetCode之旅(16)
Climbing StairsYou 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?经典的跳台
2014-08-28 14:21:41
1653
原创 LeetCode之旅(15)
Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, r
2014-08-28 14:15:02
308
原创 LeetCode之旅(13)
Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each n
2014-08-27 15:56:25
303
原创 LeetCode之旅(9)
Unique Binary Search TreesGiven n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's.
2014-08-26 21:50:10
343
原创 LeetCode之旅(8)
Reverse IntegerReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321
2014-08-26 00:20:10
377
原创 LeetCode之旅(4)
Sort ListSort a linked list in O(n log n) time using constant space complexity.
2014-08-25 22:17:42
488
原创 LeetCode之旅(3)
Max Points on a LineGiven n points on a 2D plane, find the maximum number of points that lie on the same straight line.
2014-08-24 11:57:49
479
原创 LeetCode之旅(2)
Evaluate Reverse Polish NotationEvaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expressi
2014-08-24 10:46:51
390
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人