首頁

0

Rotate Image

Rotate ImageYou are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up:Could you do this in-place? 提示 解題應用 Array Array/Slice Default:123fu

0

Permutations II

Permutations IIGiven a collection of numbers that might contain duplicates, return all possible unique permutations. For example:[1,1,2] have the following unique permutations: 12345[ [1,1,2], [1,2

0

Permutations

PermutationsGiven a collection of distinct numbers, return all possible permutations. For example:[1,2,3] have the following permutations: 12345678[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2],

0

Multiply Strings

Multiply StringsGiven two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2. Note: The length of both num1 and num2 is < 110. Both num1 and num2 cont

0

Combination Sum II

Combination Sum IIGiven a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each number in C may only be used once

0

Combination Sum

Combination SumGiven a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may

0

Search Insert Position

Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no dupl

0

Search for a Range

Search for a RangeGiven an array of integers sorted in ascending order, find the starting and ending position of a given target value. Your algorithm’s runtime complexity must be in the order of O(lo

0

Search in Rotated Sorted Array

Search in Rotated Sorted ArraySuppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target v

0

Next Permutation

Next PermutationImplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the l

0

Implement strStr()

Implement strStr()Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 提示 解題應用 TwoPointers KMP演算法 String 規律觀查 Defa

0

Generate Parentheses

Generate ParenthesesGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example:Given n = 3, a solution set is: 1234567[ "((()))",

0

4Sum

4SumGiven 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 which gives the sum of target. Note: The solution

0

Letter Combinations of a Phone Number

Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons)

0

3Sum Closest

3Sum ClosestGiven 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 integers. You may assume that each input would

0

3Sum

3SumGiven 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 of zero. Note: The solution set must not contain

0

Integer to Roman

Integer to RomanGiven an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 提示 解題應用 Math 規律觀查 String 規律觀查 Default:123func intToRoman(num in

0

Container With Most Water

Container With Most WaterGiven 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 endpoints of line i is at (i, a

0

Repeated Substring Pattern

Repeated Substring PatternGiven a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string

0

Longest Palindromic Substring

Longest Palindromic SubstringGiven a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1:12345Input: "babad"Output: "b

0

Longest Substring Without Repeating Characters

Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For Examples:12345Given "abcabcbb", the answer is "

0

Add Two Numbers

Add Two NumbersYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numb