原创 Lintcode 149. Best Time to Buy and Sell Stock

題目鏈接:https://www.lintcode.com/problem/best-time-to-buy-and-sell-stock/description 有點慚愧,這個代碼我本地測了幾組用例應該是沒問題的,但是OJ報了W

原创 Lintcode 152. Combinations

題目鏈接:https://www.lintcode.com/problem/combinations/description func combine(n int, k int) [][]int { // write your

原创 Lintcode 148. Sort Colors

題目鏈接:https://www.lintcode.com/problem/sort-colors/description /** * @param nums: A list of integer which is 0, 1 o

原创 Lintcode 143. Sort Colors II

題目鏈接:https://www.lintcode.com/problem/sort-colors-ii/description 最近在刷一下go語言,寫一些go的解法: /** * @param colors: A list

原创 Lintcode 151. Best Time to Buy and Sell Stock III

題目鏈接:https://www.lintcode.com/problem/best-time-to-buy-and-sell-stock-iii/description const INT_MAX = int(^uint(0)

原创 Lintcode 150. Best Time to Buy and Sell Stock II

題目鏈接:https://www.lintcode.com/problem/best-time-to-buy-and-sell-stock-ii/description /** * @param prices: Given an

原创 Lintcode 153. Combination Sum II

題目鏈接:https://www.lintcode.com/problem/combination-sum-ii/description /** * @param num: Given the candidate numbers

原创 Lintcode 160. Find Minimum in Rotated Sorted Array II

題目鏈接:https://www.lintcode.com/problem/find-minimum-in-rotated-sorted-array-ii/description /** * @param nums: a rota

原创 Lintcode 159. Find Minimum in Rotated Sorted Array

題目鏈接:https://www.lintcode.com/problem/find-minimum-in-rotated-sorted-array/description /** * @param nums: a rotated

原创 Lintcode 161. Rotate Image

題目鏈接:https://www.lintcode.com/problem/rotate-image/description /** * @param matrix: a lists of integers * @return:

原创 從面向對象設計角度,全面解讀——JS中的函數與對象、Object與Function、以及原型鏈與繼承

本文,將會拋開__proto__的存在,轉而從JS語言面向對象設計的角度,去全面解讀函數與對象、Object與Function、以及原型鏈與繼承。 主題目錄如下: 類與對象的概念JS中的對象JS中的objectJS中的函數JS中的

原创 Haskell 自定義排序

注意處理相同的元素 1快排 qsort []=[] qsort (h:t)=(qsort(filter (<h) t) )++(num (h:t)) ++(qsort(filter (>h) t)) num (h:t)=fi

原创 swift自定義排序

摘自stackoverflow的問答 用了幾分鐘做的簡單翻譯 一個例子 直接貼代碼,不過多解釋 //這是我們的model class imageFile { var fileName = String() va

原创 erlang 自定義排序

erlang下lists模塊sort(排序)方法源碼解析(二) 土豆008 2018-05-23 原文 上接erlang下lists模塊sort(排序)方法源碼解析(一),到目前爲止,list列表已經被分割成N個列表,而且每個列

原创 freopen和fopen的在ACM競賽中的簡單使用

在程序設計競賽中,當我們遇到需要大量的輸入數據情況下就可以採用文件的方式來存儲我們的輸入數據,爲下次調試程序時節省了很多時間; 首先我們來說下freopen()這個函數, 1.它是c標準庫中的函數,也就是#include<stdi