`
frank-liu
  • 浏览: 1682351 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
问题描述: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note:Given m, n satisfy the following condition:1 ≤ m ≤ n ≤ length o ...
问题描述: A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine the total number of ways to decode it. For example,Given encoded message "12", it cou ...
问题描述: Given a collection of integers that might contain duplicates, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example,If nums = [1,2,2], a solution is:   [ [2], [1], [1,2,2], [2,2], [1,2], [] ] 原问题链接:https://leetcode ...
问题描述: 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 total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0. For example, given n = 2, return [0,1,3,2] ...
问题描述: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2. The number of elements initialized in nums1 andnums2 are m and n respe ...
问题描述: Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representation of s1 = "great": great / \ gr eat / \ / \ g r e at / \ a t To scramble ...
问题描述: 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 preserve the original relative order of the nodes in each of the two partitions. For example,Given 1->4->3->2->5->2 and x = 3,return 1-> ...
问题描述:   Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area. 原问题链接:https://leetcode.com/problems/maximal-rectangle/   问题分析   这个问题的解决思路其实依赖于前面一篇文章里求柱状图最大覆盖面积的思路。在前面的问题里,是针对一组数字求它所涵盖的面积。而这里因为提供的元素是一个矩阵,我们可以将它最初的一行当做一个柱状图,这样就可以得到一个 ...
问题描述: 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 in the histogram. Above is a histogram where width of each bar is 1, given height = [2,1,5,6,2,3].   The largest rectangle is shown in the shaded ...
问题描述: Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3. 原问题链接:https://leetcode.com/problems/remove-duplicates-from-sorted-list ...
问题描述: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example,Given 1->2->3->3->4->4->5, return 1->2->5.Given 1->1->1->2->3, return 2->3. 原问题链接:https://leetcode.com/problems/ ...
问题描述: Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a function to determine if a given target is in the array. 原问题链接:https://leetcode.com/problems/search-in-rotated-so ...
问题描述: Follow up for "Remove Duplicates":What if duplicates are allowed at most twice? For example,Given sorted array nums = [1,1,1,2,2,3], Your function should return length = 5, with the first five elements of nums being 1, 1, 2, 2 and 
问题描述: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once. For example,Give ...
问题描述: Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example,If nums = [1,2,3], a solution is:   [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ] 原问题链接:https://leetcode.com/proble ...
Global site tag (gtag.js) - Google Analytics