【050-Implement pow(x, n)(求x的n次方)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Implement pow(x, n).
题目大意 求x的n次方。
解题思路 递归求解。
代码实现算法实现类public class Solution { public double myPow(double x, int n) {...
分类:
编程语言 时间:
2015-07-28 06:43:24
阅读次数:
166
【046-Permutations(求排列)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a collection of numbers, return all possible permutations.
For example,
[1,2,3] have the following permutations:
[1,2,3], [1,...
分类:
编程语言 时间:
2015-07-28 06:43:13
阅读次数:
129
【035-Search Insert Position(搜索插入位置)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if...
分类:
编程语言 时间:
2015-07-27 08:16:01
阅读次数:
172
【036-Valid Sudoku(验证数独棋盘)】】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
The Sudoku board could be partially filled, where empty cel...
分类:
编程语言 时间:
2015-07-27 08:13:29
阅读次数:
301
【034-Search for a Range(搜索一个范围)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm’s runtime comple...
分类:
编程语言 时间:
2015-07-27 08:13:21
阅读次数:
328
【033-Search in Rotated Sorted Array(在旋转数组中搜索)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6...
分类:
编程语言 时间:
2015-07-26 07:32:11
阅读次数:
170
【032-Longest Valid Parentheses(最长有效括号)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses su...
分类:
编程语言 时间:
2015-07-26 07:31:04
阅读次数:
198
[【028-Implement strStr() (实现strStr()函数)】](028-Implement strStr() (实现strStr()函数))【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Implement strStr().
Returns the index of the first occurrence of needle in hayst...
分类:
编程语言 时间:
2015-07-25 09:32:21
阅读次数:
152
【024-Swap Nodes in Pairs(成对交换单链表的结点)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return...
分类:
编程语言 时间:
2015-07-24 08:05:47
阅读次数:
166
【025-Reverse Nodes in k-Group(单链表中k个结点一组进行反转)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of...
分类:
编程语言 时间:
2015-07-24 08:04:47
阅读次数:
143