04 2017 档案
摘要:题目: Given a collection of distinct numbers, return all possible permutations. For example,[1,2,3] have the following permutations: 题解: 之前解过Next Permut
阅读全文
摘要:题目: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not po
阅读全文
摘要:题目: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 ->
阅读全文
摘要:题目: Remove all elements from a linked list of integers that have value val. Example 题解: 这道题没什么好讲的,基础操作。需要注意的是链表的第一个node,因为没有前驱节点,所以该node需要特殊处理,会导致额外的代
阅读全文
摘要:题目: Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array,
阅读全文
摘要:题目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra spac
阅读全文
摘要:题目: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stoppin
阅读全文
摘要:题目: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-
阅读全文
摘要:题目: Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,
阅读全文
摘要:题目: Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums exc
阅读全文
摘要:题目: 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 after rain
阅读全文
摘要:题目: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two e
阅读全文
摘要:题目: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexit
阅读全文
摘要:题目: Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero. To make
阅读全文
摘要:题目: Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition nums[
阅读全文
摘要:题目: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integ
阅读全文
摘要:题目: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array
阅读全文
摘要:题目: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum
阅读全文
摘要:题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would hav
阅读全文
摘要:题目: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes co
阅读全文