原创 LeetCode 之 Merge Two / k Sorted Lists — C/C++ 實現

Merge Two Sorted Lists   Merge two sorted linked lists and return it as a new list. The new list should be made by sp

原创 LeetCode 之 Insertion Sort List — C++ 實現

Insertion Sort List   Sort a linked list using insertion sort. 對鏈表使用插入排序。 class Solution { public: ListNode* inse

原创 LeetCode 之 Reverse Words in a String — C 實現

Reverse Words in a String   Given an input string, reverse the string word by word. For example, Given s = "the s

原创 LeetCode 之 Linked List Cycle I II — C++ 實現

Linked List Cycle Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using

原创 LeetCode 之 Partition List — C++ 實現

Partition List Given a linked list and a value x, partition it such that all nodes less than x come before nodes gre

原创 LeetCode 之 Reverse Integer — C++ 實現

Reverse Integer   Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 將一個

原创 LeetCode 之 Rotate Array — C++ 實現

Rotate Array   Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the arra

原创 LeetCode 之 Remove Linked List Elements — C 實現

Remove Linked List Elements Remove all elements from a linked list of integers that have value val. ExampleGiven: 1

原创 LeetCode 之 Contains Duplicate I II III — C++ 實現

Contains Duplicate   Given an array of integers, find if the array contains any duplicates. Your function should retu

原创 LeetCode 之 Reverse Linked List — C 實現

Reverse Linked List   Reverse a singly linked list. 翻轉鏈表。 struct ListNode* reverseList(struct ListNode* head) { s

原创 LeetCode 之 Compare Version Numbers — C 實現

Compare Version Numbers   Compare two version numbers version1 and version2. If version1 > version2 return 1, if v

原创 LeetCode 之 Remove Nth Node From End of List — C++ 實現

Remove Nth Node From End of List   Given a linked list, remove the nth node from the end of list and return its he

原创 LeetCode 之 Valid Palindrome — C 實現

Valid Palindrome Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignor

原创 LeetCode 之 Palindrome Number — C++ 實現

Palindrome Number Determine whether an integer is a palindrome. Do this without extra space. 確定一個整數是不是迴文。要求空間複雜度爲O(1).

原创 LeetCode 之 Intersection of Two Linked Lists — C/C++ 實現

Intersection of Two Linked Lists   Write a program to find the node at which the intersection of two singly linked