原创 【LeetCode算法練習(C++)】Implement strStr()

題目: Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not

原创 【LeetCode算法練習(C++)】Valid Parentheses

題目: Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string i

原创 【LeetCode算法練習(C++)】Reverse Nodes in k-Group

題目: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a pos

原创 【LeetCode算法練習(C++)】Remove Duplicates from Sorted Array

題目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the n

原创 【LeetCode算法練習(C++)】Remove Nth Node From End of List

題目: Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked

原创 【LeetCode算法練習(C++)】Next Permutation

題目: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of nu

原创 【LeetCode算法練習(C++)】Letter Combinations of a Phone Number

題目: Given a digit string, return all possible letter combinations that the number could represent. A mapping of

原创 【LeetCode算法練習(C++)】Divide Two Integers

題目: Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_I

原创 【LeetCode算法練習(C++)】Swap Nodes in Pairs

題目: Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you

原创 【LeetCode算法練習(C++)】Remove Element

題目: Given an array and a value, remove all instances of that value in place and return the new length. Do not al

原创 【LeetCode算法練習(C++)】Longest Valid Parentheses

題目: Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed)

原创 【LeetCode算法練習(C++)】Substring with Concatenation of All Words

題目: You are given a string, s, and a list of words, words, that are all of the same length. Find all starting ind

原创 【LeetCode算法練習(C++)】4Sum

題目: 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

原创 【LeetCode算法練習(C++)】Merge k Sorted Lists

題目: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 鏈接:Merge k

原创 【LeetCode算法練習(C++)】Merge Two Sorted Lists

題目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the