随笔分类 - leetcode
摘要:https://leetcode.com/problems/single-number/Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algor...
阅读全文
摘要:https://leetcode.com/problems/add-and-search-word-data-structure-design/本题是在Trie树进行dfs+backtracking操作。Trie树模板代码见:http://www.cnblogs.com/fu11211129/p/4...
阅读全文
摘要:https://leetcode.com/problems/multiply-strings/Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The nu...
阅读全文
摘要:https://leetcode.com/problems/spiral-matrix/Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For examp...
阅读全文
摘要:https://leetcode.com/problems/rotate-image/You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Cou...
阅读全文
摘要:https://leetcode.com/problems/valid-sudoku/Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially...
阅读全文
摘要:https://leetcode.com/problems/longest-increasing-subsequence/Given an unsorted array of integers, find the length of longest increasing subsequence.Fo...
阅读全文
摘要: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...
阅读全文
摘要:STL中的list就是一双向链表,可高效地进行插入删除元素。List是C++标准程式库中的一个类,可以简单视之为双向连结串行,以线性列的方式管理物件集合。list 的特色是在集合的任何位置增加或删除元素都很快,但是不支持随机存取。list 是C++标准程式库提供的众多容器(container)之一,...
阅读全文
摘要:https://leetcode.com/problems/range-sum-query-immutable/class NumArray {public: vector vec;public: NumArray(vector &nums) { if(nums.empty())...
阅读全文
摘要:https://leetcode.com/problems/word-search/class Solution {public: struct Trie{ Trie *next[57]; bool isWord; Trie() { ...
阅读全文
摘要:Trie 树模板https://leetcode.com/problems/implement-trie-prefix-tree/class TrieNode {public: char var; bool isWord; TrieNode *next[26]; TrieNo...
阅读全文
摘要: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...
阅读全文
摘要:https://leetcode.com/problems/largest-rectangle-in-histogram/https://leetcode.com/problems/maximal-rectangle/ 1 class Solution { 2 public: 3 int l...
阅读全文
摘要:https://leetcode.com/problems/perfect-squares/Given a positive integern, find the least number of perfect square numbers (for example,1, 4, 9, 16, ......
阅读全文
摘要: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...
阅读全文
摘要:https://leetcode.com/problems/minimum-size-subarray-sum/Given an array ofnpositive integers and a positive integers, find the minimal length of a suba...
阅读全文
摘要:https://leetcode.com/problems/generate-parentheses/Given n pairs of parentheses, write a function to generate all combinations of well-formed parenthe...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文

浙公网安备 33010602011771号