C
文章平均质量分 75
pehaps
这个作者很懒,什么都没留下…
展开
-
常量指针和指针常量 大端小端的记法
int a; int * const p = &a //指针常量,*p可以修改*p = 8;(OK) p不可以修改 p++(ERROR) int a,b; const int *p = &a;//常量指针 *p不可修改 *p = 8;(ERROR)原创 2013-06-04 20:34:57 · 593 阅读 · 0 评论 -
leecode Partition List
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of t原创 2013-10-22 19:40:53 · 543 阅读 · 0 评论 -
Container With Most Water
Given 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 line i is at (i, ai) and (i, 0). Find tw原创 2013-10-22 19:45:24 · 616 阅读 · 0 评论 -
求数组两两之差绝对值最小的值
题目是这样的:有一个整数数组,请求出两两之差绝对值最小的值,记住,只要得出最小值即可,不需要求出是哪两个数。 这题首先一看就很面熟,貌似此类的题很多了,数组的最大连续和,最小连续绝对值等等。O(N^2)的解法肯定是最基础的,不过面试一般这种解法都是无用的。 解法一: 一轮排序,然后两两相邻的依次相减,次解法也没什么难度。 解法二: 下面就开始找有没有O(n)的解法了,今天的重头戏就来了,原创 2013-10-29 21:26:46 · 1781 阅读 · 0 评论 -
Largest Rectangle in Histogram
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram. Above is a histogram where width of ea原创 2013-10-22 19:44:35 · 552 阅读 · 0 评论 -
leecode Decode Ways
Decode Ways A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, d原创 2013-10-22 19:47:27 · 662 阅读 · 0 评论