0

# Find the Duplicate Number

Find the Duplicate NumberGiven an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is onl

0

# Minimum Size Subarray Sum

Minimum Size Subarray SumGiven an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn’t one, return 0 instead. F

0

# Two Sum II - Input array is sorted

Two Sum II - Input array is sortedGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should

0

# Partition List

Partition ListGiven 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 node

0

# Remove Duplicates from Sorted Array II

Remove Duplicates from Sorted Array IIFollow up for “Remove Duplicates”:What if duplicates are allowed at most twice? For example:123Given sorted array nums = [1,1,1,2,2,3],Your function should retur

0

# Sort Colors

Sort ColorsGiven an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the

0

# Rotate List

Rotate ListGiven a list, rotate the list to the right by k places, where k is non-negative. For example:12Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.

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

# 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

# 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

# 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

# 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

# K-diff Pairs in an Array

K-diff Pairs in an ArrayGiven an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i

0

# Reverse Vowels of a String

Reverse Vowels of a StringWrite a function that takes a string as input and reverse only the vowels of a string. Example1:1Given s = "hello", return "holle". Example 2:1Given s =

0

# Intersection of Two Arrays

Intersection of Two ArraysGiven two arrays, write a function to compute their intersection. ###For Example: 1Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return . Note: Each element in the result

0

# Intersection of Two Arrays II

Intersection of Two Arrays IIGiven two arrays, write a function to compute their intersection. For Example:1Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each element in the resul

0

# Reverse String

Reverse StringWrite a function that takes a string as input and returns the string reversed. For Example:1Given s = "hello", return "olleh". 提示 解題應用 TwoPointers String D

0

# Move Zeroes

Move ZeroesGiven an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For example:1Given nums = [0, 1, 0, 3, 12], after call

0

Palindrome Linked ListGiven a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space? 提示 解題應用 LinkedList Pointer Default:12345678910/**

0

# Valid Palindrome

Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example:12"A man, a plan, a canal: Panama" is a palindrome.

0

# Merge Sorted Array

Merge Sorted ArrayGGiven 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 +