- 博客(11)
- 收藏
- 关注
原创 数组:Remove Element&Merge Sorted Array&First Missing Positive
Remove Elementpublic int removeElement(int[] nums, int val) { int count = 0; for(int i=0;i<nums.length;i++){ if(nums[i]!=val){ nums[count] = nums[i];
2015-10-22 11:42:29 375
原创 遍历技巧:2,3,4sum&3sum closest&set matrix zeroes&Container With Most Water
2 sumpublic class Solution { public int[] twoSum(int[] nums, int target) { int[] res = new int[2]; HashMap map = new HashMap(); for(int i=0;i<nums.length;i++){
2015-10-21 09:31:36 392
转载 Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).public class Solution {
2015-10-05 08:27:17 364
转载 Candy
There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least on
2015-10-02 06:38:41 362
转载 Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire input st
2015-10-02 06:34:14 257
转载 Best Time to Buy and Sell Stock IV
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most k transactions.public class Solu
2015-10-02 06:21:58 321
转载 Minimum Window Substring
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window is "BAN
2015-10-02 06:14:05 224
转载 Dungeon Game
https://leetcode.com/problems/dungeon-game/public class Solution { public int calculateMinimumHP(int[][] dungeon) { if (dungeon == null || dungeon.length == 0 || dungeon[0].length == 0) r
2015-10-02 06:03:04 265
转载 Expression Add Operators
Given a string that contains only digits 0-9 and a target value, return all possibilities to add binaryoperators (not unary) +, -, or * between the digits so they evaluate to the target value.
2015-10-02 05:57:47 268
转载 Shortest Palindrome
Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can find by performing this transformation.For exam
2015-10-02 05:48:01 228
转载 Wildcard matching
Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should cover t
2015-10-02 04:30:18 235
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人