LeetCode – 561. Array Partition I

題目來源:LeetCode – 561. Array Partition I


題目:

Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possible.

Example 1:

Input: [1,4,3,2]
Output: 4
Explanation: n is 2, and the maximum sum of pairs is 4.

Note:

  1. n is a positive integer, which is in the range of [1, 10000].
  2. All the integers in the array will be in the range of [-10000, 10000].

Read more »

LeetCode – 535. Encode and Decode TinyURL

題目來源:LeetCode – 535. Encode and Decode TinyURL


題目:

TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL such as http://tinyurl.com/4e9iAk.

Design the encode and decode methods for the TinyURL service. There is no restriction on how your encode/decode algorithm should work. You just need to ensure that a URL can be encoded to a tiny URL and the tiny URL can be decoded to the original URL.

Read more »

robomongo連線問題

如果遇到 Failed to create SSH tunnel to A.B.C.D Error when starting up SSH session: -8 . (Error #11)

或是 Failed to create SSH tunnel

然後你發現如果把/etc/mongod.conf的Binding IP取消掉就能正常連線,那你就先注意一下robomongo的設定頁,在SSH那裡先確認正確,再來是Connection那一頁的Address要輸入的是127.0.0.1,不是你mongodb機器的真實IP/DN。

 

禁止手機上的瀏覽器做縮放

不管是什麼理由, 偶爾就是希望不要縮放以免畫面跑掉, 這時可以用這一行搞定

資料來源

http://stackoverflow.com/questions/4389932/how-do-you-disable-viewport-zooming-on-mobile-safari

« Older Entries