随笔分类 -  leetcode

摘要:https://leetcode.com/problems/single-number/Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algor... 阅读全文
posted @ 2015-11-18 14:42 流白 阅读(169) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/add-and-search-word-data-structure-design/本题是在Trie树进行dfs+backtracking操作。Trie树模板代码见:http://www.cnblogs.com/fu11211129/p/4... 阅读全文
posted @ 2015-11-17 19:36 流白 阅读(231) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/multiply-strings/Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The nu... 阅读全文
posted @ 2015-11-17 14:39 流白 阅读(247) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/spiral-matrix/Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For examp... 阅读全文
posted @ 2015-11-17 12:48 流白 阅读(202) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/rotate-image/You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Cou... 阅读全文
posted @ 2015-11-16 15:13 流白 阅读(140) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/valid-sudoku/Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially... 阅读全文
posted @ 2015-11-14 14:46 流白 阅读(217) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/longest-increasing-subsequence/Given an unsorted array of integers, find the length of longest increasing subsequence.Fo... 阅读全文
posted @ 2015-11-13 14:23 流白 阅读(240) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/number-of-islands/Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounde... 阅读全文
posted @ 2015-11-13 14:01 流白 阅读(250) 评论(0) 推荐(0)
摘要:STL中的list就是一双向链表,可高效地进行插入删除元素。List是C++标准程式库中的一个类,可以简单视之为双向连结串行,以线性列的方式管理物件集合。list 的特色是在集合的任何位置增加或删除元素都很快,但是不支持随机存取。list 是C++标准程式库提供的众多容器(container)之一,... 阅读全文
posted @ 2015-11-12 21:57 流白 阅读(465) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/range-sum-query-immutable/class NumArray {public: vector vec;public: NumArray(vector &nums) { if(nums.empty())... 阅读全文
posted @ 2015-11-12 19:20 流白 阅读(274) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/word-search/class Solution {public: struct Trie{ Trie *next[57]; bool isWord; Trie() { ... 阅读全文
posted @ 2015-11-10 11:00 流白 阅读(493) 评论(0) 推荐(0)
摘要:Trie 树模板https://leetcode.com/problems/implement-trie-prefix-tree/class TrieNode {public: char var; bool isWord; TrieNode *next[26]; TrieNo... 阅读全文
posted @ 2015-11-10 10:58 流白 阅读(193) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/search-in-rotated-sorted-array/Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5... 阅读全文
posted @ 2015-11-07 12:59 流白 阅读(163) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/largest-rectangle-in-histogram/https://leetcode.com/problems/maximal-rectangle/ 1 class Solution { 2 public: 3 int l... 阅读全文
posted @ 2015-11-06 14:32 流白 阅读(204) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/perfect-squares/Given a positive integern, find the least number of perfect square numbers (for example,1, 4, 9, 16, ...... 阅读全文
posted @ 2015-11-02 14:11 流白 阅读(299) 评论(1) 推荐(0)
摘要:https://leetcode.com/problems/intersection-of-two-linked-lists/Write a program to find the node at which the intersection of two singly linked lists b... 阅读全文
posted @ 2015-11-01 15:38 流白 阅读(212) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/minimum-size-subarray-sum/Given an array ofnpositive integers and a positive integers, find the minimal length of a suba... 阅读全文
posted @ 2015-11-01 15:19 流白 阅读(169) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/generate-parentheses/Given n pairs of parentheses, write a function to generate all combinations of well-formed parenthe... 阅读全文
posted @ 2015-10-28 10:00 流白 阅读(834) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/sliding-window-maximum/Given an arraynums, there is a sliding window of sizekwhich is moving from the very left of the a... 阅读全文
posted @ 2015-10-27 13:55 流白 阅读(214) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/find-median-from-data-stream/Median is the middle value in an ordered integer list. If the size of the list is even, the... 阅读全文
posted @ 2015-10-27 12:40 流白 阅读(270) 评论(0) 推荐(0)