- 博客(7)
- 收藏
- 关注
原创 10Regular 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 stri
2016-06-25 16:53:48 254
原创 17. Letter Combinations of a Phone Number
public List letterCombinations(String digits) { //递归 枚举 List result = new ArrayList(); if("".equals(digits)||digits.length()==0) return result; Stri
2016-06-25 16:32:47 221
原创 22. Generate Parentheses
public List generateParenthesis(int n) { ArrayList result = new ArrayList(); dfs(result, "", n, n); return result; } public void dfs(ArrayList result, String s, int left, int right){//其中l
2016-06-25 16:26:26 213
原创 Valid Parentheses 合法括号
public boolean isValid(String s) { Stack stack = new Stack(); int i =0; char []temp = s.toCharArray(); while(i<temp.length) { if(stack.isEmpty()) { if(temp[i]=='('||temp[
2016-06-25 16:22:26 221
原创 1Roman to Integer 2 Integer to Roman 3 Integer to English Words转化问题
罗马数字七个对应的: case 'I': return 1; case 'V': return 5; case 'X': return 10; case 'L': return 50; case 'C': return 100;
2016-06-25 16:15:02 236
原创 8. String to Integer (atoi)
//重点是考虑全边界值 public int myAtoi(String str) { if (str == null || str.length() < 1) return 0; // 去掉空格 str = str.trim(); char flag = '+'; //确定正负 int i = 0; if (str.charAt(0) ==
2016-06-25 15:54:53 245
原创 3. Longest Substring Without Repeating Characters
思路:是要找到无重复字母的最大子串 循环遍历时间复杂度太高 可以定义一个辅助数组; public int lengthOfLongestSubstring(String s) { int res = 0;//结果 int left = 0;//维持一个left指针 指向没有重复字母的子
2016-06-25 15:49:49 208
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人