原创 LeetCode 004. Median of Two Sorted Arrays

4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the

原创 九大經典排序算法整理及其源代碼分享(C/C++版)

一、 9大排序算法介紹 1.1 直接插入排序(Insertion Sort) 插入排序是一種簡單直觀的排序算法。它的工作原理是通過構建有序序列,對於未排序數據在已排序序列中從前向後掃描,找到相應位置並插入。插入排序在實現上,通常採用in-

原创 LeetCode 419 BattleshipsInABoard DFS、BFS簡單的入門

419. Battleships in a Board Given an 2D board, count how many different battleships are in it. The battleships are re

原创 LeetCode 167 TwoSumII-InputArrayIsSorted

167. Two Sum II - Input array is sorted Given an array of integers that is already sorted in ascending order, find tw

原创 C/C++語言 二維數組作爲函數的參數總結

一、       情況1:實參爲二維數組. 1 二、       情況2:實參爲指針數組. 1 三、       情況3:實參爲數組指針. 2 四、       情況4:實參爲二維指針. 2 五、       總結. 3 5.1    

原创 LeetCode 006 ZigZagConversion

6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this:

原创 LeetCode 003. Longest Substring Without Repeating Characters

3. Longest Substring Without Repeating Characters Given a string, find the length of the longest substring without r

原创 LeetCode 015 3Sum

15. 3Sum Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all uniq

原创 LeetCode 021. Merge Two Sorted Lists

21. 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 067. Add Binary

67. Add Binary Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Retu

原创 LeetCode 009. Palindrome Number

9. Palindrome Number Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could

原创 LeetCode 012 Integer to Roman

12. Integer to Roman Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from

原创 LeetCode 016 3SumClosest

16. 3Sum Closest Given an array S of n integers, find three integers in S such that the sum is closest to a given n

原创 LeetCode 013 Roman to Integer

13. Roman to Integer Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from

原创 LeetCode 008 StringToInteger(atoi)

8. String to Integer (atoi) Implement atoi to convert a string to an integer. Hint: Carefully consider all possible