Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.求最大深度,用递归的方法/**
* Definition for a binary...
分类:
其他好文 时间:
2015-06-11 19:26:53
阅读次数:
126
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-06-11 18:25:40
阅读次数:
104
1318: [Spoj744] Longest PermutationTime Limit: 10 SecMemory Limit: 162 MBSubmit: 361Solved: 215[Submit][Status][Discuss]Description给你一个序列A含有n个正整数(1#in...
分类:
其他好文 时间:
2015-06-11 18:23:22
阅读次数:
141
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs...
分类:
其他好文 时间:
2015-06-11 14:20:49
阅读次数:
93
题目描述Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longes...
分类:
其他好文 时间:
2015-06-11 12:36:10
阅读次数:
110
substring 方法用于提取字符串中介于两个指定下标之间的字符substring(start,end)开始和结束的位置,从零开始的索引参数 描述start 必需。一个非负的整数,规定要提取的子串的第一个字符在 stringObject 中的位置。stop 可选。一个非负的整数,比要提取的子...
分类:
Web程序 时间:
2015-06-10 18:57:19
阅读次数:
88
No.14 Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.求一组string的最长公共前缀想法:找到最短的那个,然后依次对比典型的字...
分类:
其他好文 时间:
2015-06-10 15:28:49
阅读次数:
107
/背景知识/substring 方法用于提取字符串中介于两个指定下标之间的字符substring(start,end)开始和结束的位置,从零开始的索引参数描述start 必需。一个非负的整数,规定要提取的子串的第一个字符在 stringObject 中的位置。stop 可选。一个非负的整数,...
分类:
编程语言 时间:
2015-06-10 14:04:04
阅读次数:
143
private void changeToMp3(String sourcePath) { File source = new File(sourcePath); String mp3TargetPath = sourcePath.substring(0, sou...
分类:
其他好文 时间:
2015-06-10 07:39:05
阅读次数:
267
leetcode中有几道题使用同一个思路,大致是先维护一个窗口,每次只移动窗口左侧或者右侧的边界,然后针对这个窗口内的元素进行处理。这种方式使用两个指针,可以将问题的运行时间降到O(n)内。Longest Substring Without Repeating Characters:https://...
分类:
其他好文 时间:
2015-06-10 06:34:45
阅读次数:
412