随笔分类 - LeetCode
摘要:【题目】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,−1,...
阅读全文
摘要:【题目】Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. Y...
阅读全文
摘要:【题目】Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:El...
阅读全文
摘要:【题目】Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your ma...
阅读全文
摘要:【题目】Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your ma...
阅读全文
摘要:【问题】Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each num...
阅读全文
摘要:【问题】Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated...
阅读全文
摘要:【题目】Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a functio...
阅读全文
摘要:【题目】Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3, You should return the following ...
阅读全文
摘要:【题目】Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, ...
阅读全文
摘要:题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target valu...
阅读全文
摘要:题目:Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ...
阅读全文
摘要:问题:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space fo...
阅读全文
摘要:题目:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find themaximum profit. You may complete...
阅读全文
摘要:题目:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complet...
阅读全文
摘要:题目:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction ...
阅读全文
摘要:题目:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two...
阅读全文

浙公网安备 33010602011771号