摘要:https://leetcode.com/problems/distinct-subsequences/Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a ...
阅读全文
随笔分类 - LeetCode
摘要:https://leetcode.com/problems/sort-list/ Sort a linked list in O(n log n) time using constant space complexity. 解题思路: 常见的O(nlogn)算法,快速排序、归并排序,堆排序。大概讲讲
阅读全文
摘要:https://leetcode.com/problems/permutation-sequence/ The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the
阅读全文
摘要:https://leetcode.com/problems/jump-game-ii/Given an array of non-negative integers, you are initially positioned at the first index of the array.Each ...
阅读全文
摘要:https://leetcode.com/problems/jump-game/ Given an array of non-negative integers, you are initially positioned at the first index of the array. Each e
阅读全文
摘要:https://leetcode.com/problems/insertion-sort-list/Sort a linked list using insertion sort.解题思路:先回忆一下插入排序。对于num[i],将他插入到前面已经排好序的0...i-1的合适的位置。i从0-n遍历。这...
阅读全文
摘要:https://leetcode.com/problems/factorial-trailing-zeroes/Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in l...
阅读全文
摘要:https://leetcode.com/problems/trapping-rain-water/Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute ...
阅读全文
摘要:https://leetcode.com/problems/candy/There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these child...
阅读全文
摘要:https://leetcode.com/problems/compare-version-numbers/Compare two version numbersversion1andversion2.Ifversion1>version2return 1, ifversion1 Integer.p...
阅读全文
摘要:https://leetcode.com/problems/subsets-ii/Given a collection of integers that might contain duplicates,S, return all possible subsets.Note:Elements in ...
阅读全文
摘要:https://leetcode.com/problems/subsets/Given a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descend...
阅读全文
摘要:https://leetcode.com/problems/length-of-last-word/Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the leng...
阅读全文
摘要:https://leetcode.com/problems/longest-consecutive-sequence/ Given an unsorted array of integers, find the length of the longest consecutive elements s
阅读全文
摘要:https://leetcode.com/problems/sum-root-to-leaf-numbers/Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a num...
阅读全文
摘要:https://leetcode.com/problems/combinations/ Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n
阅读全文
摘要:https://leetcode.com/problems/spiral-matrix-ii/Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example...
阅读全文
摘要: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/substring-with-concatenation-of-all-words/ You are given a string, S, and a list of words, L, that are all of the same l
阅读全文
摘要:https://leetcode.com/problems/combination-sum-ii/description/ Given a collection of candidate numbers (C) and a target number (T), find all unique com
阅读全文

浙公网安备 33010602011771号