码迷,mamicode.com
首页 >  
搜索关键字:b. ohana cleans up    ( 7828个结果
POJ 2828 Buy Tickets 线段树解法
此题应用线段树的方法非常巧妙。没做过真的难想得出是这么想的。 是一个逆向思维的运用。 其实一看到这道题目我就想到要运用逆向思维的了,但是就是没那么容易想通的。 思路: 1 要从后面往前更新线段树 2 线段树记录的是当前区间还剩下多少个记录空间 3 因为后面的插入会使得前面的插入往后退,那么前面插入的下标如果大于前面可以插入的空间,就需要往后退了。 好难理解的操作。仔细观察一下下面up...
分类:其他好文   时间:2014-06-19 12:54:26    阅读次数:248
Rotate Image
题目 You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place? 方法 矩阵坐标的转换,循环替换。 public voi...
分类:其他好文   时间:2014-06-16 11:28:03    阅读次数:199
[leetcode]Search in Rotated Sorted Array II @ Python
原题地址:https://oj.leetcode.com/problems/search-in-rotated-sorted-array-ii/题意:Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed...
分类:编程语言   时间:2014-06-16 08:20:54    阅读次数:307
[leetcode]Unique Paths II @ Python
原题地址:https://oj.leetcode.com/problems/unique-paths-ii/题意:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many ...
分类:编程语言   时间:2014-06-15 23:33:26    阅读次数:353
LeetCode——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 ...
分类:其他好文   时间:2014-06-15 19:26:23    阅读次数:207
LeetCode: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 bin...
分类:其他好文   时间:2014-06-15 09:34:35    阅读次数:226
【Leetcode】Rotate Image
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place? 思路:第一种思路是一层一层的进行旋转,比较直观,但是花费的时间要久一些;第二种思路则比较取巧,首先沿着...
分类:其他好文   时间:2014-06-15 08:46:26    阅读次数:170
Leetcode:Path Sum 二叉树路径和
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 giv...
分类:其他好文   时间:2014-06-13 16:09:02    阅读次数:237
Leetcode:Linked List Cycle 链表是否存在环
Linked List Cycle:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?解题分析:大致思想就是设置两个指针,一个指针每次...
分类:其他好文   时间:2014-06-13 14:41:54    阅读次数:238
*HDU 1394 经典逆序数的四种解法
1、暴力【代码】: 1 /*HDU1394暴力写法*/ 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 int A[50005]; 9 int Low[50005],Up[50005];10 int main(){...
分类:其他好文   时间:2014-06-12 12:02:37    阅读次数:191
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!