- 博客(12)
- 收藏
- 关注
原创 leetcode 150: Candy
"这种两边扫描的方法是一种比较常用的技巧,LeetCode中 Trapping Rain Water和这道题都用到了,可以把这种方法作为自己思路的一部分,通常是要求的变量跟左右元素有关系的题目会用到哈。" []
2014-06-27 08:45:22 1279
原创 leetcode 149: Copy List with Random Pointer
Copy List with Random Pointer Total Accepted: 12884 Total Submissions: 56931 A linked list is given such that each node contains an additional random pointer which could point to any node in th
2014-06-26 09:05:25 604
原创 leetcode 148: Word Break
Word Break Total Accepted: 15458 Total Submissions: 75841 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 dictio
2014-06-26 08:27:00 617
原创 leetcode 147: Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up: Can you solve it without using extra space? /** * Definition for singly-linked list.
2014-06-26 06:53:16 563
原创 leetcode 146: Reorder List
1 /** * Definition for singly-linked list. * class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */ public
2014-06-26 06:23:22 623
原创 leetcode 145: LRU Cache
1 public class LRUCache { private int capacity; private int count; private Map map; private ListNode head, tail; public LRUCache(int capacity) { this.capacity = c
2014-06-26 02:15:52 724
原创 leetcode 144: Evaluate Reverse Polish Notation
1 public class Solution { public int evalRPN(String[] tokens) { Stack stack= new Stack(); for(int i=0; i<tokens.length; i++) { String s = tokens[i];
2014-06-24 08:09:32 706
原创 leetcode 143: Maximal Rectangle (incomplete)
Maximal Rectangle Total Accepted: 7242 Total Submissions: 33510 Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area. public c
2014-06-20 13:22:46 646
原创 leetcode 142: Reverse Words in a String
1 // " fadf the fdasf fdfaf " // "a" public class Solution { public String reverseWords(String s) { if(s==null || s.length() == 0 ) return s; StringBuilde
2014-06-20 05:15:19 709
原创 Leetcode 141: Max Points on a Line
1 /** * Definition for a point. * class Point { * int x; * int y; * Point() { x = 0; y = 0; } * Point(int a, int b) { x = a; y = b; } * } */ public class Solution { pu
2014-06-19 14:23:27 666
原创 leetcode 140: Letter Combinations of a Phone Number
1 2 class Solution { public: vector letterCombinations(string digits) { vector res; string temp; rec(res, temp, digits, 0); return res; } pr
2014-06-11 02:29:28 1116
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人