线性扫描
文章平均质量分 88
StevenIsSnail
辛苦理所当然。年轻就拼搏。挑战不确定。
展开
-
【线性扫描i】 valid number 数字格式是否正确
1 class Solution {public: inline bool isDg(char c){ return c>='0'&&c } bool isNumber(const char *s) { int i=0; while(s[i]==' '){ i++;原创 2014-07-29 16:45:08 · 687 阅读 · 0 评论 -
【矩阵二维或三维dp】最大子矩阵,子矩阵快速求和(用到最大直方图)
Maximal Rectangle Total Accepted: 9039 Total Submissions: 41503My SubmissionsGiven a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return i原创 2014-08-02 17:46:47 · 1142 阅读 · 0 评论 -
【线性扫描】题型总结:最大积连续序列,str2int,2sum, 4sum,reverse word, 链表操作, 蛇形访问, 最大蓄水池,直方图最大矩形
Maximum Product Subarray Total Accepted: 12665 Total Submissions: 77402My SubmissionsQuestion Solution Find the contiguous subarray within an array (containing at least one numbe原创 2014-11-18 01:27:42 · 744 阅读 · 0 评论 -
【九章算法】经典题目
九章算法面试题42 构造MaxTree原创 2014-11-20 22:52:51 · 3966 阅读 · 3 评论 -
【数据结构_链表_最小堆】 链表找环,链表找交点,合并有序链表
Linked List Cycle Total Accepted: 24481 Total Submissions: 68828My SubmissionsGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra sp原创 2014-08-02 21:27:41 · 585 阅读 · 1 评论 -
【Ksum】求和问题总结(leetcode 2Sum, 3Sum, 4Sum, K Sum)
人 sigmainfy — http://tech-wonderland.net/blog/summary-of-ksum-problems.html前言:做过leetcode的人都知道, 里面有2sum, 3sum(closest), 4sum等问题, 这些也是面试里面经典的问题, 考察是否能够合理利用排序这个性质, 一步一步得到高效的算法. 经过总结, 本人觉得转载 2014-11-14 07:04:24 · 1720 阅读 · 0 评论 -
【双数组二分法+控制划分点】两有序数组取第k小数
Median of Two Sorted Arrays Total Accepted: 16280 Total Submissions: 95001My SubmissionsThere are two sorted arrays A and B of size m and n respectively. Find the median of the two sorte原创 2014-08-01 22:42:10 · 878 阅读 · 1 评论 -
【双层loop】题型总结
class Solution {public: vector spiralOrder(vector > &matrix) { vector res; int x=-1,y=0;/// 巧妙设置起点 int n=matrix.size(); if(n==0) return res; int m=matrix[原创 2014-08-02 00:42:09 · 682 阅读 · 0 评论 -
【线性扫描 while ijk】总结
Longest Valid Parentheses原创 2014-08-01 22:07:30 · 564 阅读 · 0 评论 -
【线性扫描ijk_贪心】candy 最少蛋糕分配、Trapping Rain water
Candy Total Accepted: 14466 Total Submissions: 78095My SubmissionsThere are N children standing in a line. Each child is assigned a rating value.You are giving candies to these childre原创 2014-08-01 21:43:05 · 683 阅读 · 0 评论 -
网易游戏实习招聘
推箱子是一款经典游戏。如图所示,灰色格子代表不能通过区域,蓝色方格是箱子,黑色圆形代表玩家,含有圆点的格子代表目标点。规定以下规则:1、一局游戏中只会有一个箱子,一个玩家和一个目标点。2、通过方向键控制玩家移动。3、图中的灰色格子代表墙壁,玩家与箱子都不能通过。4、推到墙壁的箱子,就无法再将箱子推离墙壁,因为玩家无法到达箱子靠墙壁的一侧去推箱子。也就是说箱子只能原创 2015-04-08 22:08:29 · 1893 阅读 · 0 评论