- 博客(9)
- 收藏
- 关注
原创 [letecode Java] Word Break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"
2015-12-17 15:57:14
159
原创 Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest
2015-11-12 10:44:39
160
原创 [letecode] Range Sum Query - Immutable
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1sumRan
2015-11-12 09:49:30
195
原创 [letecode Java] Decode Ways
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, determine the total nu
2015-11-08 13:59:45
157
原创 滑动窗口、栈、队列等的应用
大小为K的滑动窗口在算法题中,通常用于解决查找满足一定要求的两个元素,且两个元素的位置差异不超过K。常见的问题如Letecode上的问题Contains Duplicate III。问题描述:Given an array of integers, find out whether there are two distinct indices i and j in the array
2015-10-12 17:37:12
66
原创 [hihoCoder java] Trie数(字典树)
经典的字典树问题,把AC的代码放在这,作为备忘录。因为对这些经典的问题并不是很熟悉,所以要记录下来。import java.util.Scanner;public class Main {private final int SIZE=26;private TrieNode rootNode;//字典树的根/*** @param args*/Main()
2015-09-28 22:52:30
252
原创 [letecode java] Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.此题将一个已排序数组转换为平衡二叉搜索树,典型的递归题目。每次得到数组的中间元素,作为根节点root,中间元素之前的数组部分作为root的左子树,中间元素之后的数组部分作为root的右子树,即可
2015-09-16 09:21:08
150
原创 [letecode java] Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [4,−1,2,1] ha
2015-09-15 15:29:14
185
原创 [letecode java]Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo
2015-09-09 10:28:45
198
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人