LeetCode: Maximum Subarray


Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

...繼續閱讀 »

LeetCode: Search Insert Position


Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.

...繼續閱讀 »

LeetCode: Merge Two Sorted Lists

回傳兩個已經排序過的linked list的合併,僅能使用原有的linked list回傳。

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.


...繼續閱讀 »

LeetCode: Longest Common Prefix


Write a function to find the longest common prefix string amongst an array of strings.

If there is no common prefix, return an empty string "".


...繼續閱讀 »

LeetCode: Two Sum

在一組陣列中找出兩個數,其加總恰等於給定值。 每個數不能被重複使用,且必剛好只有一個解。

Given an array of integers, return indices of the two numbers such that they add up to a specific target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

...繼續閱讀 »

.Net 設計模式: 模式和模式目錄介紹


1.創建者模式: 抽象工廠(abstract factory)、工廠方法(factory method)、建造者(builder)、原型(prototype)、單例(singleton)

2.結構型模式: 轉接器(adapter)、橋接(bridge)、合成(composite)、代理(proxy) 等等...

3.行為型模式: 中介者(mediator)、觀察者(observer)、責任練(chain of responsibility) 等等...

...繼續閱讀 »