- 博客(92)
- 资源 (22)
- 收藏
- 关注
原创 【LeetCode-面试算法经典-Java实现】【059-Spiral Matrix II(螺旋矩阵II)】
【059-Spiral Matrix II(螺旋矩阵II)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, Yo
2015-07-31 07:07:31 2903
原创 【LeetCode-面试算法经典-Java实现】【058-Length of Last Word (最后一个单词的长度)】
【058-Length of Last Word (最后一个单词的长度)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the
2015-07-31 07:05:48 2837 1
原创 【LeetCode-面试算法经典-Java实现】【057-Insert Interval(插入区间)】
【057-Insert Interval(插入区间)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the inte
2015-07-31 07:02:51 2907 1
原创 【LeetCode-面试算法经典-Java实现】【077-Combinations(组合数)】
【077-Combinations(组合数)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given two integers n and k, return all possible combinations of k numbers out of 1 … n. For example, If n = 4 and k = 2, a solution is
2015-07-30 06:38:44 3190
原创 【LeetCode-面试算法经典-Java实现】【075-Sort Colors (颜色排序)】
【075-Sort Colors (颜色排序)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the
2015-07-30 06:36:18 3157
原创 【LeetCode-面试算法经典-Java实现】【074-Search a 2D Matrix(搜索二维矩阵)】
【074-Search a 2D Matrix(搜索二维矩阵)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in
2015-07-30 06:34:39 3303 1
原创 【LeetCode-面试算法经典-Java实现】【056-Merge Intervals(区间合并)】
【056-Merge Intervals(区间合并)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[
2015-07-29 06:51:47 5238 1
原创 【LeetCode-面试算法经典-Java实现】【054-Spiral Matrix(螺旋矩阵)】
【054-Spiral Matrix(螺旋矩阵)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the foll
2015-07-29 06:49:20 3616 2
原创 【LeetCode-面试算法经典-Java实现】【053-Maximum Subarray(最大子数组和)】
【053-Maximum Subarray(最大子数组和)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the ar
2015-07-29 06:46:34 3795 2
原创 【LeetCode-面试算法经典-Java实现】【050-Implement pow(x, n)(求x的n次方)】
【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:05:26 5195
原创 【LeetCode-面试算法经典-Java实现】【046-Permutations(求排列)】
【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:01:43 3454
原创 【LeetCode-面试算法经典-Java实现】【038-Count and Say(计数和表述)】
【038-Count and Say(计数和表述)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as "one 1"
2015-07-28 05:59:07 4040 1
原创 【LeetCode-面试算法经典-Java实现】【036-Valid Sudoku(验证数独棋盘)】
【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 07:21:10 4633 1
原创 【LeetCode-面试算法经典-Java实现】【035-Search Insert Position(搜索插入位置)】
【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 07:18:33 3883 1
原创 【LeetCode-面试算法经典-Java实现】【034-Search for a Range(搜索一个范围)】
【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 07:17:03 3462 2
原创 【LeetCode-面试算法经典-Java实现】【033-Search in Rotated Sorted Array(在旋转数组中搜索)】
【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 06:48:59 2900
原创 【LeetCode-面试算法经典-Java实现】【032-Longest Valid Parentheses(最长有效括号)】
【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 06:46:19 3675
原创 【LeetCode-面试算法经典-Java实现】【030-Substring with Concatenation of All Words(串联所有单词的子串)】
【030-Substring with Concatenation of All Words(串联所有单词的子串)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 You are given a string, s, and a list of words, words, that are all of the same length. Find all starting
2015-07-26 06:44:48 3196
原创 【LeetCode-面试算法经典-Java实现】【029-Divide Two Integers(两个整数相除)】
【029-Divide Two Integers(两个整数相除)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 题目大意 不使用除法,乘法
2015-07-25 08:12:27 4138 2
原创 【LeetCode-面试算法经典-Java实现】【028-Implement strStr() (实现strStr()函数)】
[【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 08:08:32 3893
原创 【LeetCode-面试算法经典-Java实现】【027-Remove Element(删除数组中指定的元素)】
【027-Remove Element(删除数组中的元素)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be ch
2015-07-25 08:03:58 4605
原创 【LeetCode-面试算法经典-Java实现】【026-Remove Duplicates from Sorted Array(删除排序数组中的重复元素)】
【026-Remove Duplicates from Sorted Array(删除排序数组中的重复元素)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a sorted array, remove the duplicates in place such that each element appear only once and return the
2015-07-24 07:01:05 3927
原创 【LeetCode-面试算法经典-Java实现】【025-Reverse Nodes in k-Group(单链表中k个结点一组进行反转)】
【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 06:58:08 3817 2
原创 【LeetCode-面试算法经典-Java实现】【024-Swap Nodes in Pairs(成对交换单链表的结点)】
【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 06:55:18 3053
原创 【LeetCode-面试算法经典-Java实现】【023-Merge k Sorted Lists(合并k个排好的的单链表)】
【023-Merge k Sorted Lists(合并k个排好的的单链表)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 题目大意 合并k个排好的的单链表。分析和描述它
2015-07-23 07:56:52 2908
原创 【LeetCode-面试算法经典-Java实现】【022-Generate Parentheses(生成括号)】
【022-Generate Parentheses(生成括号)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3
2015-07-23 07:52:20 3367
原创 【LeetCode-面试算法经典-Java实现】【021-Merge Two Sorted Lists(合并两个排好序的单链表)】
【021-Merge Two Sorted Lists(合并两个排好序的单链表)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of t
2015-07-23 07:48:31 3673 1
原创 【LeetCode-面试算法经典-Java实现】【020-Valid Parentheses(括号验证)】
【020-Valid Parentheses(括号验证)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. The brackets
2015-07-22 07:26:55 4124 3
原创 【LeetCode-面试算法经典-Java实现】【019-Remove Nth Node From End of List(移除单链表的倒数第N个节点)】
【019-Remove Nth Node From End of List(移除单链表的倒数第N个节点)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a linked list, remove the nth node from the end of list and return its head. For example, Given lin
2015-07-22 07:24:29 3776
原创 【LeetCode-面试算法经典-Java实现】【018-4Sum(四个数的和)】
【018-4Sum(四个数的和)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array
2015-07-22 07:22:02 4724
原创 【LeetCode-面试算法经典-Java实现】【017-Letter Combinations of a Phone Number (电话号码上的单词组合)】
【017-Letter Combinations of a Phone Number (电话号码上的单词组合)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a digit string, return all possible letter combinations that the number could represent. A mapping
2015-07-21 07:27:32 3805
原创 【LeetCode-面试算法经典-Java实现】【016-3 Sum Closest(最接近的三个数的和)】
【016-3 Sum Closest(最接近的三个数的和)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of th
2015-07-21 07:22:05 4500
原创 【LeetCode-面试算法经典-Java实现】【015-3 Sum(三个数的和)】
【013-3 Sum(三个数的和)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the su
2015-07-21 07:15:45 5991 1
原创 【LeetCode-面试算法经典-Java实现】【014-Longest Common Prefix(最长公共前缀)】
【014-Longest Common Prefix(最长公共前缀)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Write a function to find the longest common prefix string amongst an array of strings. 题目大意 写一个函数找出一个字串所数组中的最长的公共前缀。 解题思路 第一
2015-07-20 07:22:56 4300
原创 【LeetCode-面试算法经典-Java实现】【013-Roman to Integer (罗马数字转成整数)】
【013-Roman to Integer (罗马数字转成整数)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 题目大意 给定一个罗马数字,将其转
2015-07-20 07:20:28 3752 1
原创 【LeetCode-面试算法经典-Java实现】【012-Integer to Roman(数字转罗马字符)】
【012-Integer to Roman(数字转罗马字符)】输入一个数字,将它转成一个罗马数字,输入的数字在[1, 3999]之间。 罗马数字的表示: 个位数举例: (I, 1) (II, 2) (III, 3) (IV, 4) (V, 5) (VI, 6) (VII, 7) (VIII, 8) (IX, 9) 十位数举例:(X, 10) (XI, 11) (XII, 12) (X
2015-07-20 07:16:58 3442
原创 【LeetCode-面试算法经典-Java实现】【011-ContainerWithMostWater(容纳最多的水)】
【011-ContainerWithMostWater(容纳最多的水)】找两条竖线然后这两条线以及X轴构成的容器能容纳最多的水。使用贪心算法 1.首先假设我们找到能取最大容积的纵线为 i, j (假定i < j),那么得到的最大容积 C = min( ai , aj ) * ( j- i) ; 2.下面我们看这么一条性质: ①: 在 j 的右端没有一条线会比它高!假设存在 k |( j < k && ak
2015-07-19 06:58:05 4407
原创 【LeetCode-面试算法经典-Java实现】【010-Regular Expresssion Matching(正则表达式匹配)】
【010-Regular Expresssion Matching(正则表达式匹配)】实现一个正则表达式匹配算法,.匹配任意一个字符,*匹配0个或者多个前导字符。使用标记匹配算法法,从后向前进行匹配。
2015-07-19 06:53:11 3737
原创 【LeetCode-面试算法经典-Java实现】【009-Palindrome Number(回文数)】
【009-Palindrome Number(回文数)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】题目大意 判断一个数字是否是回访字数,不要使用额外的空间。 解题思路 为了不使用额外的空间,参考了其它的解决,那些解法看起来在isPalindrome方法中没有使用额外参数,但是却使用了方法调用,这个比一个整数消耗的空间更多 ,并没有达到题目的要求,是假的实现,所以本题依然采用一个额外的空间
2015-07-19 06:43:35 4491
原创 【LeetCode-面试算法经典-Java实现】【008-String to Integer (atoi) (字符串转成整数)】
【008-String to Integer (atoi) (字符串转成整数)】实现一个atoi函数,将字符串转成整形。要点:考虑所有的输入情况。前导字符是+或-或者没有,接下来输入的是数字,数字不能整数能表示的最大或最小数。如果超过就返回对应的最小或者最小的值。
2015-07-18 06:30:47 6113 1
Java CP/IP Socket编程
2012-04-13
嵌入式试卷
2011-11-24
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人