Processing math: 100%

02 2020 档案

摘要:Problem : Given a non empty string s and a dictionary wordDict containing a list of non empty words, determine if s can be segmented into a space sepa 阅读全文
posted @ 2020-02-21 21:48 littledy 阅读(95) 评论(0) 推荐(0) 编辑
摘要:Problem : 思路 : 用DP算法。状态方程为: Solution (C++) : 性能 : Runtime: 8 ms Memory Usage: 8.9 MB 阅读全文
posted @ 2020-02-18 20:33 littledy 阅读(99) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given bin 阅读全文
posted @ 2020-02-17 22:01 littledy 阅读(79) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node con 阅读全文
posted @ 2020-02-17 21:14 littledy 阅读(90) 评论(0) 推荐(0) 编辑
摘要:Problem : Given an integer n , generate all structurally unique BST's (binary search trees) that store values 1 ... n . Example: 思路 : 同样采用递归的思想。若节点i 阅读全文
posted @ 2020-02-17 10:13 littledy 阅读(87) 评论(0) 推荐(0) 编辑
摘要:Problem : Given n , how many structurally unique BST 's (binary search trees) that store values 1 ... n ? Example: 思路 : 二叉搜索树(Binary Search Tree, BST) 阅读全文
posted @ 2020-02-16 11:43 littledy 阅读(78) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a binary tree, return the inorder traversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it i 阅读全文
posted @ 2020-02-16 10:47 littledy 阅读(112) 评论(0) 推荐(0) 编辑
摘要:Problem : Given n non negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle i 阅读全文
posted @ 2020-02-16 10:17 littledy 阅读(82) 评论(0) 推荐(0) 编辑
摘要:Problem : Reverse a linked list from position m to n . Do it in one pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: 思路 : 保存2个节点 和`cur pre cur cur nex 阅读全文
posted @ 2020-02-15 23:31 littledy 阅读(93) 评论(0) 推荐(0) 编辑
摘要:Problem : 思路 : Solution (C++) : 性能 : Runtime: 20 ms Memory Usage: 19.9 MB 阅读全文
posted @ 2020-02-12 20:56 littledy 阅读(74) 评论(0) 推荐(0) 编辑
摘要:Problem : 思路 : Solution (C++) : 性能 : Runtime: 8 ms Memory Usage: 19.9 MB 阅读全文
posted @ 2020-02-12 19:55 littledy 阅读(83) 评论(0) 推荐(0) 编辑
摘要:Problem : 思路 : Solution (C++) : 性能 : Runtime: 8 ms Memory Usage: 9.1 MB 阅读全文
posted @ 2020-02-12 19:42 littledy 阅读(99) 评论(0) 推荐(0) 编辑
摘要:Problem : 思路 : Solution (C++) : 性能 : Runtime: 8 ms Memory Usage: 10.4 MB 阅读全文
posted @ 2020-02-12 18:41 littledy 阅读(65) 评论(0) 推荐(0) 编辑
摘要:Solution (C++) : 性能 : Runtime: 0 ms Memory Usage: 9.1 MB 阅读全文
posted @ 2020-02-11 19:34 littledy 阅读(57) 评论(0) 推荐(0) 编辑
摘要:Solution (C++) : 阅读全文
posted @ 2020-02-11 19:05 littledy 阅读(76) 评论(0) 推荐(0) 编辑
摘要:Solution (C++) : 阅读全文
posted @ 2020-02-11 19:03 littledy 阅读(72) 评论(0) 推荐(0) 编辑
摘要:Problem : The n queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Solution (C++) : 阅读全文
posted @ 2020-02-11 18:53 littledy 阅读(92) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example 1: Example 2: 思路 : 每次遍历从左上角 阅读全文
posted @ 2020-02-11 18:52 littledy 阅读(85) 评论(0) 推荐(0) 编辑
摘要:Problem : Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules : 1. Each of 阅读全文
posted @ 2020-02-11 09:36 littledy 阅读(119) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a collection of candidate numbers ( ) and a target number ( ), find all unique combinations in where the candidate numbers sums to . E 阅读全文
posted @ 2020-02-10 18:27 littledy 阅读(82) 评论(0) 推荐(0) 编辑
摘要:Problem : Given n non negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap afte 阅读全文
posted @ 2020-02-10 14:41 littledy 阅读(93) 评论(0) 推荐(0) 编辑
摘要:Problem : Given an array of non negative integers, you are initially positioned at the first index of the array. Each element in the array represents 阅读全文
posted @ 2020-02-10 13:50 littledy 阅读(84) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example: 思路 : 遍历二维数组中的 阅读全文
posted @ 2020-02-10 10:44 littledy 阅读(102) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, gi 阅读全文
posted @ 2020-02-09 22:22 littledy 阅读(88) 评论(0) 推荐(0) 编辑
摘要:Problem : Given two words word1 and word2 , find the minimum number of operations required to convert word1 to word2 . You have the following 3 operat 阅读全文
posted @ 2020-02-09 22:07 littledy 阅读(83) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a set of candidate numbers ( ) ( without duplicates ) and a target number ( ), find all unique combinations in where the candidate num 阅读全文
posted @ 2020-02-09 11:54 littledy 阅读(77) 评论(0) 推荐(0) 编辑
摘要:Problem : Given an input string ( ) and a pattern ( ), implement wildcard pattern matching with support for ' ' and ' '. Note: could be empty and cont 阅读全文
posted @ 2020-02-09 10:51 littledy 阅读(113) 评论(0) 推荐(0) 编辑
摘要:Problem : A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a 阅读全文
posted @ 2020-02-09 10:44 littledy 阅读(116) 评论(0) 推荐(0) 编辑
摘要:Problem : A message containing letters from is being encoded to numbers using the following mapping: Given a non empty string containing only digits, 阅读全文
posted @ 2020-02-08 22:19 littledy 阅读(120) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a linked list, return the node where the cycle begins. If there is no cycle, return . To represent a cycle in the given linked list, w 阅读全文
posted @ 2020-02-07 20:55 littledy 阅读(89) 评论(0) 推荐(0) 编辑
摘要:异或性质 [1]: 交换律:A ^ B = B ^ A; 结合律:A ^ (B ^ C) = (A ^ B) ^ C; 恒等律:X ^ 0 = X; 归零律:X ^ X = 0; 自反:A ^ B ^ B = A ^ 0 = A; 对于任意的 X: X ^ ( 1) = ~X; 如果 A ^ B = 阅读全文
posted @ 2020-02-07 09:23 littledy 阅读(564) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a m x n grid filled with non negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along 阅读全文
posted @ 2020-02-06 19:23 littledy 阅读(81) 评论(0) 推荐(0) 编辑
摘要:Problem : A robot is located at the top left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or righ 阅读全文
posted @ 2020-02-06 18:12 littledy 阅读(96) 评论(0) 推荐(0) 编辑
摘要:动态规划具备以下三个特点: 1.把原来的问题分解成几个 相似的子问题 ; 2.所有的子问题 只需要解决一次 ; 3. 储存 子问题的解。 LeetCode DP算法分类题目链接: 动态规划的问题有很多种,只能通过多刷才能知道对哪一类的问题应用DP算法求解方便。 阅读全文
posted @ 2020-02-06 16:15 littledy 阅读(115) 评论(0) 推荐(0) 编辑
摘要:Problem : A robot is located at the top left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or righ 阅读全文
posted @ 2020-02-06 12:05 littledy 阅读(88) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a linked list, determine if it has a cycle in it. To represent a cycle in the given linked list, we use an integer pos which represent 阅读全文
posted @ 2020-02-06 09:39 littledy 阅读(153) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a non empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a li 阅读全文
posted @ 2020-02-05 22:58 littledy 阅读(89) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the purpose of this 阅读全文
posted @ 2020-02-05 22:27 littledy 阅读(70) 评论(0) 推荐(0) 编辑
摘要:Problem : Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You 阅读全文
posted @ 2020-02-05 11:05 littledy 阅读(83) 评论(0) 推荐(0) 编辑
摘要:Problem : Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one t 阅读全文
posted @ 2020-02-04 20:47 littledy 阅读(92) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a non negative index k where k ≤ 33, return the kth index row of the Pascal's triangle. Note that the row index starts from 0. In Pasc 阅读全文
posted @ 2020-02-04 20:05 littledy 阅读(81) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a non negative integer numRows, generate the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the t 阅读全文
posted @ 2020-02-04 11:22 littledy 阅读(92) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a string containing only digits, restore it by returning all possible valid IP address combinations. Example: 思路 : 首先弄清楚IP地址的定义。 Defin 阅读全文
posted @ 2020-02-04 10:37 littledy 阅读(88) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a collection of integers that might contain duplicates, nums , return all possible subsets (the power set). Note: The solution set mus 阅读全文
posted @ 2020-02-03 23:21 littledy 阅读(83) 评论(0) 推荐(0) 编辑
摘要:Problem : The gray code is a binary numeral system where two successive values differ in only one bit. Given a non negative integer n representing the 阅读全文
posted @ 2020-02-03 10:29 littledy 阅读(105) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should pre 阅读全文
posted @ 2020-02-03 09:05 littledy 阅读(79) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Example 1: E 阅读全文
posted @ 2020-02-02 10:28 littledy 阅读(81) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a sorted array nums, remove the duplicates in place such that duplicates appeared at most twice and return the new length. Do not allo 阅读全文
posted @ 2020-02-02 09:47 littledy 阅读(83) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a set of distinct integers, nums , return all possible subsets (the power set). Note: The solution set must not contain duplicate subs 阅读全文
posted @ 2020-02-02 08:54 littledy 阅读(113) 评论(0) 推荐(0) 编辑
摘要:Problem : Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. Example: 思路 : 这题的思路很难直接用语言表述,建议看代码,然后再纸上将其每一步运行的结果 阅读全文
posted @ 2020-02-02 07:56 littledy 阅读(77) 评论(0) 推荐(0) 编辑
摘要:Problem : Given an array with n objects colored red, white or blue, sort them in place so that objects of the same color are adjacent, with the colors 阅读全文
posted @ 2020-02-01 10:17 littledy 阅读(81) 评论(0) 推荐(0) 编辑
摘要:Problem : Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row ar 阅读全文
posted @ 2020-02-01 09:31 littledy 阅读(94) 评论(0) 推荐(0) 编辑
摘要:Problem : Given a m×n matrix, if an element is 0, set its entire row and column to 0. Do it in place. Example 1: Example 2: Follow up: A stra 阅读全文
posted @ 2020-02-01 08:27 littledy 阅读(84) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示