原创 LeetCode (34) Reverse Linked List

題目描述 Reverse a singly linked list. 例如: 1 -> 2 -> 3 -> 4 -> 5 -> 6 ==> 6 -> 5 -> 4 -> 3 -> 2 -> 1 本題比較簡單,使用兩個指針,一個指

原创 Leetcode (28) Longest Consecutive Sequence

Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Gi

原创 LeetCode (20) house robber (數組不相鄰元素最大值)

題目描述 You are a professional robber planning to rob houses along a street. Each house has a certain amount of money

原创 LeetCode (26) LRU Cache

題目描述 Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following ope

原创 LeetCode (19) Multiply Strings

題目描述 Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers

原创 LeetCode (29) Fraction to Recurring Decimal

題目描述 Given two integers representing the numerator and denominator of a fraction, return the fraction in string for

原创 LeetCode (21) Find Minimum in Rotated Sorted Array (with/without duplicates)

題目描述 Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4

原创 LeetCode (32) Add Two Numbers (字符串)

題目描述 You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order a

原创 LeetCode (27) Linked List Cycle (判斷cycle存在、尋找cycle入口節點)

判斷cycle存在 Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra s

原创 LeetCode(37) Contain Duplicates I II

共有兩道與重複數字相關的題目,contain duplicates I 和 II。 Contain Duplicates I 題目描述 Given an array of integers, find if the array c

原创 LeetCode (31) Divide two integers (不使用 *, /, mod 求兩個數相除結果)

題目描述 Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT

原创 LeetCode (24) Happy Number

題目描述 Write an algorithm to determine if a number is “happy”. A happy number is a number defined by the following pr

原创 LeetCode (25) 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. If the numbe

原创 OpenCV保存成XML(FileStorage)和CSV(重載

XML文件(使用FileStorage類) 使用OpenCV時不僅要保存影像結果,往往也需要保存中間的矩陣結果,而OpenCV的imwrite函數只支持CV8U類型的數據(使用OpenCV保存其他類型Mat的時候,程序不會報錯,但

原创 LeetCode (22) Word Search

題目描述 Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of