1、
??
Recover Binary Search Tree
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n) space is pretty...
分类:
其他好文 时间:
2014-06-20 10:13:49
阅读次数:
243
原题地址:https://oj.leetcode.com/problems/merge-k-sorted-lists/题意:Mergeksorted
linked lists and return it as one sorted list. Analyze and describe its com...
分类:
编程语言 时间:
2014-06-11 21:57:07
阅读次数:
399
感谢 微信平台: 一天一道算法题 ---每天多一点进步----话说 这题 我百度了一下
没找到哪个OJ 有出这题下次 来给我们的学弟学妹们把....那我来说下题目大意:给你一个n 问你从1,2,3……n中选出3个数 能够构成多少种不同的三角形
比如N=5 可以有(2,3,4)(2,3,5)(3,4,...
分类:
其他好文 时间:
2014-06-11 11:48:58
阅读次数:
180
原题地址:https://oj.leetcode.com/problems/search-insert-position/题意:Given
a sorted array and a target value, return the index if the target is found. If
n...
分类:
编程语言 时间:
2014-06-11 11:28:40
阅读次数:
349
原题地址:https://oj.leetcode.com/problems/plus-one/题意:Given
a non-negative number represented as an array of digits, plus one to the
number.The digits are...
分类:
编程语言 时间:
2014-06-11 11:25:27
阅读次数:
304
原题地址:https://oj.leetcode.com/problems/rotate-image/题意:You
are given annxn2D matrix representing an image.Rotate the image by 90 degrees
(clockwise).Fo...
分类:
编程语言 时间:
2014-06-11 09:43:59
阅读次数:
1264
原题地址:https://oj.leetcode.com/problems/powx-n/题意:Implement
pow(x,n).解题思路:求幂函数的实现。使用递归,类似于二分的思路,解法来自Mark Allen Weiss的《数据结构与算法分析》。代码:class
Solution: #...
分类:
编程语言 时间:
2014-06-11 08:59:33
阅读次数:
317
原题地址:https://oj.leetcode.com/problems/edit-distance/题意:Given
two wordsword1andword2, find the minimum number of steps required to
convertword1toword2....
分类:
编程语言 时间:
2014-06-11 08:58:49
阅读次数:
293
题目来源:Light OJ 1268 Unlucky Strings
题意:给你一些可以用的字符 然后求组成不包含给定字符串的方案数
思路:矩阵经典问题 从i走k步路到达j的方案数 可以用矩阵快速幂求解
对于求长度为n的字符的方案数 就是走n步路 求走法
可以用KMP求出走一步 从前i个字符到前j个字符的方案数 这点有点不好理解 想一想
#include
#include
#...
分类:
其他好文 时间:
2014-06-07 14:33:43
阅读次数:
303
杭电OJ(HDU)-ACM Steps-Chapter Two-《Biker's Trip Odometer》《Climbing Worm》《hide handkerchief》《Nasty Hac》...
分类:
其他好文 时间:
2014-06-07 11:39:31
阅读次数:
315