原创 LeetCode - 189. Rotate Array - 思路詳解 - C++

題目 Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6

原创 LeetCode - 121. Best Time to Buy and Sell Stock - 思路詳解 - C++

題目 Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitt

原创 LeetCode - 153. Find Minimum in Rotated Sorted Array - 思路詳解- C++

題目 Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5

原创 LeetCode - 228. Summary Ranges - 思路詳解- C++

題目 Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5

原创 LeetCode - 162. Find Peak Element - 思路詳解 - C++

題目 A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], f

原创 LeetCode - 122. Best Time to Buy and Sell Stock II - 思路詳解 - C++

題目 Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to f

原创 APUE-第一章學習-UNIX基礎知識-習題

習題 1.1,在系統上查證,除根目錄外,目錄.和..是不同的。 普通目錄對比 根目錄對比 1.2, 分析程序1-4的輸出,說明進程ID爲852和853的進程發生了什麼情況? 代碼 /*1-4 * print the

原创 LeetCode - 217. Contains Duplicate - 思路詳解 - C++

題目 Given an array of integers, find if the array contains any duplicates. Your function should return true if any v

原创 LeetCode - 216. Combination Sum III - 思路詳解 - C++

題目 Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can b

原创 LeetCode - 128. Longest Consecutive Sequence - 思路詳解- C++

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

原创 LeetCode - 401. Binary Watch - 思路詳解-C++

題目 A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent th

原创 LeetCode -485. Max Consecutive Ones - 思路詳解 - C++

題目 Given a binary array, find the maximum number of consecutive 1s in this array. Note: The input array will only c

原创 LeetCode - 462. Minimum Moves to Equal Array Elements II - 思路詳解 - C++

題目 Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, whe

原创 LeetCode - 88. Merge Sorted Array - 思路詳解 - C++

題目 Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assu

原创 LeetCode-219. Contains Duplicate II-思路詳解-C++

題目 Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the arra