原创 亞馬遜2015校招在線筆試1

    截圖有重疊,大家將就一下。本人沒有參加在線筆試,主要跟大家分享一下思路。     題目的意思就是找到從起始節點開始的定長路徑,路徑必須包含一個必須要到達的節點。返回所有的路徑數,如果不存在這樣的路徑,則返回0。    

原创 使用EclEmma進行覆蓋測試

EclEmma是一個開源 Java 覆蓋測試工具。進入下面的鏈接按提示安裝集成到Eclipse中。 http://www.eclemma.org/installation.html 安裝完成後,就可以在Eclipse的tool me

原创 亞馬遜2015校招在線筆試2

這道題真是虐心。總的路線是先判斷撲克的type,type小的勝出。如果type相同,則按type內的規則繼續比較。 import java.io.BufferedReader; import java.io.IOException

原创 Merge Intervals

Problem: Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[1

原创 Eclipse 遠程調試

在遠程服務器上執行命令: root@raspberrypi:/home/cheng# java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address="8000" -jar te

原创 Jump Game II

Problem: Given an array of non-negative integers, you are initially positioned at the first index of the array. Eac

原创 Wildcard Matching

Problem: Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Mat

原创 Unique Paths II

Problem: Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths

原创 XML轉JSON

依賴的包: org.json.jar,commons-io-2.2.jar 獲取xml文件的InputStream is,使用IOUtils把is轉成String。調用XML的toJSONObject方法獲取JSON對象。 impo

原创 CloudSim內核仿真框架

    GridSim是CloudSim的構件之一。GridSim使用SimJava庫作爲事件處理和實體間的消息傳遞的框架。SimJava在搭建可擴展的仿真環境時存在侷限性。比如: 它不允許在運行時通過編程重置仿真環境。 它不支持在

原创 重寫hashCode方法

hashCode方法在Object類中定義如下: public native int hashCode(); 說明是一個本地方法,其實現和本地機器相關。我們可以在自己的類中覆蓋hashCode方法。 下面String類中重寫的ha

原创 卸載MySQL,安裝SQLite

環境:Debian 卸載MySQL: #sudo apt-get autoremove --purge mysql-server-5.0 出現是否繼續選項時,選y Do you want to continue [Y/n]? y

原创 Merge k Sorted Lists

Problem: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 採用分治來

原创 Search Insert Position

Problem: Given a sorted array and a target value, return the index if the target is found. If not, return the index

原创 Combination Sum II

Problem: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C wher