自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

fighting!

空白

  • 博客(82)
  • 收藏
  • 关注

原创 Divide and Conquer-215-Kth Largest Element in an Array

Description:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example, Given [3,2,1,5,6,4] and k =...

2018-02-16 23:31:35 215

原创 Divide And Conquer-241-Different Ways to Add Parentheses

Description: Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.E...

2018-02-16 23:25:20 211

原创 BinarySearch-222-Count Complete Tree Nodes

Description: Given a complete binary tree, count the number of nodes.Definition of a complete binary tree from Wikipedia: https://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees In a comp...

2018-02-15 23:47:41 208

原创 BinarySearch-275-H-Index II

Description:Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm?Solution:class Solution { public int hIndex(int[] citations) ...

2018-02-15 23:38:41 198

原创 BinarySearch-658-Find K Closest Elements

Description: Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If there is a tie, the smaller elements ar...

2018-02-15 23:29:34 197

原创 BinarySearch-300-Longest Increasing Subsequence

Description: Given an unsorted array of integers, find the length of longest increasing subsequence.For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing subsequence is [2, 3, 7...

2018-02-15 23:23:14 247

原创 BinarySearch-240-Search a 2D Matrix II

Description: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right. In...

2018-02-15 23:08:26 267

原创 BinarySearch-436-Find Right Interval

Description: Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point of the interval i, which can be calle...

2018-02-14 20:34:03 201

原创 BinarySearch-392-Is Subsequence

Description: Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 50...

2018-02-14 20:26:27 219

原创 BinarySearch-230-Kth Smallest Element in a BST

Description: Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST’s total elements.Follow up: Wha...

2018-02-14 20:19:47 224

原创 BinarySearch-378-Kth Smallest Element in a Sorted Matrix

Description: Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.Note that it is the kth smallest element in the sorte...

2018-02-14 20:07:19 223

原创 BinarySearch-278-First Bad Version

Description: You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is develope...

2018-02-14 19:55:22 184

原创 BinarySearch-475-Heaters

Description: Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses.Now, you are given positions of houses and heaters on a...

2018-02-13 20:09:15 211

原创 BinarySearch-374-Guess Number Higher or Lower

Description: We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I’ll tell you whether the numbe...

2018-02-13 20:01:50 262

原创 BinarySearch-744-Find Smallest Letter Greater Than Target

Description: Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in the list that is larger than the given target....

2018-02-13 19:57:57 139

原创 String-151-Reverse Words in a String

Description: Given an input string, reverse the string word by word.For example, Given s = “the sky is blue”, return “blue is sky the”.Solution:public class Solution { public String rev...

2018-02-13 19:50:56 185

原创 String-91-Decode Ways

Description: A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, de...

2018-02-13 19:47:28 210

原创 String-468-Validate IP Address

Description: Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither.IPv4 addresses are canonically represented in dot-decimal notation, which consists ...

2018-02-12 17:20:35 273

原创 String-165-Compare Version Numbers

Description: Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.You may assume that the version strings ...

2018-02-12 17:08:30 226

原创 String-5-Longest Palindromic Substring

Descrpition: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"Output: "bab"Note: "aba" is also a vali...

2018-02-12 17:05:18 206

原创 String-71-Simplify Path

Description: Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases: Did you consider the cas...

2018-02-12 17:00:53 78

原创 String-6-ZigZag Conversion

Description: The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H ...

2018-02-12 16:57:04 204

原创 String-722-Remove Comments

Description: Given a C++ program, remove comments from it. The program source is an array where source[i] is the i-th line of the source code. This represents the result of splitting the original sou...

2018-02-11 20:42:40 304

原创 String-93-Restore IP Addresses

Description: Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.3...

2018-02-11 20:33:21 170

原创 String-556-Next Greater Element III

Descriptiion: Given a positive 32-bit integer n, you need to find the smallest 32-bit integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such po...

2018-02-11 20:17:28 240

原创 String-678-Valid Parenthesis String

Description: Given a string containing only three types of characters: ‘(‘, ‘)’ and ‘*’, write a function to check whether this string is valid. We define the validity of a string by these rules:...

2018-02-11 20:07:21 185

原创 String-227-Basic Calculator II

Description: Implement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer divis...

2018-02-11 19:49:31 242

原创 String-385-Mini Parser

Description: Given a nested list of integers represented as a string, implement a parser to deserialize it.Each element is either an integer, or a list – whose elements may also be integers or othe...

2018-02-10 18:33:25 187

原创 String-522-Longest Uncommon Subsequence II

Description: Given a list of strings, you need to find the longest uncommon subsequence among them. The longest uncommon subsequence is defined as the longest subsequence of one of these strings and ...

2018-02-10 18:26:35 173

原创 String-17-Letter Combinations of a Phone Number

Description: Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.In...

2018-02-10 18:18:00 208

原创 String-49-Group Anagrams

Description: Given an array of strings, group anagrams together.For example, given: [“eat”, “tea”, “tan”, “ate”, “nat”, “bat”], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]

2018-02-10 17:59:27 162

原创 String-583-Delete Operation for Two Strings

Description: Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one character in either string.Example 1:...

2018-02-10 17:52:45 156

原创 String-12-Integer to Roman

Description: Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.Solution:class Solution { private static int[] nums = new int[]{1000...

2018-02-09 15:31:22 198

原创 String-539-Minimum Time Difference

Description: Given a list of 24-hour clock time points in “Hour:Minutes” format, find the minimum minutes difference between any two time points in the list.Example 1:Input: ["23:59","00:00"]O...

2018-02-09 15:28:56 223

原创 String-22-Generate Parentheses

Description: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())...

2018-02-09 15:19:46 147

原创 String-647-Palindromic Substrings

Description: Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings even...

2018-02-09 15:13:31 160

原创 String-28-Implement strStr()

Description: Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Outp...

2018-02-09 15:04:21 199

原创 String-14-Longest Common Prefix

Description: Write a function to find the longest common prefix string amongst an array of strings.Solution:class Solution { public String longestCommonPrefix(String[] strs) { if(st...

2018-02-08 19:48:17 212

原创 String-58-Length of Last Word

Description: Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.If the last word does not exist, return 0.Note: A...

2018-02-08 19:46:49 198

原创 String-680-Valid Palindrome II

Description: Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome.Example 1:Input: "aba"Output: TrueExample 2:Input: "abca"Output...

2018-02-08 19:43:43 348

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除