随笔分类 -  Leetcode (Java)

上一页 1 2 3 4 5 下一页

72. Edit Distance (JAVA)
摘要:Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2. You have the following 3 operations permitt 阅读全文

posted @ 2019-05-23 18:02 joannae 阅读(205) 评论(0) 推荐(0)

69. Sqrt(x) (JAVA)
摘要:Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an in 阅读全文

posted @ 2019-05-23 15:08 joannae 阅读(172) 评论(0) 推荐(0)

68. Text Justification (JAVA)
摘要:Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justif 阅读全文

posted @ 2019-05-23 12:41 joannae 阅读(231) 评论(0) 推荐(0)

62. Unique Paths (JAVA)
摘要:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p 阅读全文

posted @ 2019-05-23 11:40 joannae 阅读(250) 评论(0) 推荐(0)

60. Permutation Sequence (JAVA)
摘要:The set [1,2,3,...,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, we get the following seque 阅读全文

posted @ 2019-05-22 19:03 joannae 阅读(108) 评论(0) 推荐(0)

56. Merge Intervals (JAVA)
摘要:Given a collection of intervals, merge all overlapping intervals. Example 1: Example 2: NOTE: input types have been changed on April 15, 2019. Please 阅读全文

posted @ 2019-05-22 15:21 joannae 阅读(332) 评论(0) 推荐(0)

53. Maximum Subarray (JAVA)
摘要:iven an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Follo 阅读全文

posted @ 2019-05-21 17:29 joannae 阅读(145) 评论(0) 推荐(0)

50. Pow(x, n) (JAVA)
摘要:Implement pow(x, n), which calculates x raised to the power n(xn). Example 1: Example 2: Example 3: Note: -100.0 < x < 100.0 n is a 32-bit signed inte 阅读全文

posted @ 2019-05-06 17:03 joannae 阅读(173) 评论(0) 推荐(0)

47. Permutations II (JAVA)
摘要:Given a collection of numbers that might contain duplicates, return all possible unique permutations. Example: 有重复数字的情况,之前在Subsets II,我们采取的是在某一个递归内,用f 阅读全文

posted @ 2019-05-06 16:33 joannae 阅读(171) 评论(0) 推荐(0)

46. Permutations (JAVA)
摘要:Given a collection of distinct integers, return all possible permutations. Example: 规律:类似插入排序,每个数都有多个可插入的位置。 递归的时候:循环插入的位置。递归结束条件:插入到最后一个数。 阅读全文

posted @ 2019-05-06 15:09 joannae 阅读(211) 评论(0) 推荐(0)

45. Jump Game II (JAVA)
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文

posted @ 2019-05-06 14:06 joannae 阅读(227) 评论(0) 推荐(0)

43. Multiply Strings (JAVA)
摘要:Given two non-negative integers num1 and num2represented as strings, return the product of num1 and num2, also represented as a string. Example 1: Exa 阅读全文

posted @ 2019-05-06 11:57 joannae 阅读(127) 评论(0) 推荐(0)

42. Trapping Rain Water (JAVA)
摘要:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文

posted @ 2019-05-05 20:21 joannae 阅读(165) 评论(0) 推荐(0)

41. First Missing Positive (JAVA)
摘要:Given an unsorted integer array, find the smallest missing positive integer. Example 1: Example 2: Example 3: Note: Your algorithm should run in O(n) 阅读全文

posted @ 2019-05-05 18:06 joannae 阅读(128) 评论(0) 推荐(0)

40. Combination Sum II (JAVA)
摘要:Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numb 阅读全文

posted @ 2019-05-05 16:04 joannae 阅读(176) 评论(0) 推荐(0)

39. Combination Sum (Java)
摘要:Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the 阅读全文

posted @ 2019-05-05 14:22 joannae 阅读(145) 评论(0) 推荐(0)

34. Find First and Last Position of Element in Sorted Array (JAVA)
摘要:Given an array of integers nums sorted in ascending order, find the starting and ending position of a given targetvalue. Your algorithm's runtime comp 阅读全文

posted @ 2019-05-05 11:50 joannae 阅读(249) 评论(0) 推荐(0)

33. Search in Rotated Sorted Array (JAVA)
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib 阅读全文

posted @ 2019-05-05 11:16 joannae 阅读(142) 评论(0) 推荐(0)

32. Longest Valid Parentheses (JAVA)
摘要:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Example 1: Exampl 阅读全文

posted @ 2019-05-05 10:57 joannae 阅读(138) 评论(0) 推荐(0)

31. Next Permutation (JAVA)
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib 阅读全文

posted @ 2019-04-30 20:40 joannae 阅读(189) 评论(0) 推荐(0)

上一页 1 2 3 4 5 下一页

导航