码迷,mamicode.com
首页 >  
搜索关键字:mixed up cows    ( 9955个结果
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]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
TOP命令各个参数代表意义详解
Top命令是Linux下常用的系统性能分析工具,能实时查看系统中各个进程资源占用情况。top - 16:24:25 up 284 days, 4:59, 1 user, load average: 0.10, 0.05, 0.01Tasks: 115 total, 1 running, 114 sl...
分类:其他好文   时间:2014-06-15 06:01:13    阅读次数:310
[LeetCode] Search in Rotated Sorted Array II [36]
题目 Follow up for "Search in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a function to determine if a given target is in the array. 原题链接(点我) 解题思路 这题和Search in Rotated Sorted Array问题类似,...
分类:其他好文   时间:2014-06-14 12:44:18    阅读次数:266
【Leetcode】Unique Paths II
Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space is marked as 1 and 0 respectively in the...
分类:其他好文   时间:2014-06-14 12:02:12    阅读次数:229
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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!