Given a list of Connections, which is the Connection class (the city name at both ends of the ...
Given an integer array with no duplicates. A max tree building on this array is defined as follow: The root is the maximum number in the array The left subtree and right subtree are the max trees of t ...
2014-12-27 01:40 1 3471 推薦指數:
Given a list of Connections, which is the Connection class (the city name at both ends of the ...
DP. boolean d[i][j]: For the first i items, can we fill a backpack of size j? true or false ...
Coins in a Line III There are n coins in a line. Two players take turns to take a coin from one of ...
There are n coins with different value in a line. Two players take turns to take one or two coins fr ...
直接+沒什么好說的,關鍵在於不用+的操作: 考驗Bit Operation, 可以用按位^異或兩個操作數對應位以及carry,只是carry是1還是0需要分情況討論。求更優的解法 ...
接雨水 給出 n 個非負整數,代表一張X軸上每個區域寬度為 1 的海拔圖, 計算這個海拔圖最多能接住多少(面積)雨水。 如上圖所示,海拔分別為 [0,1,0,2,1,0,1,3,2,1, ...
Given an directed graph, a topological order of the graph nodes is defined as follow: For each d ...
There is a stone game.At the beginning of the game the player picks n piles of stones in a ci ...