標籤: Given two sparse matrices A and B, return the result of AB.You may assume that A‘s column number is equal to B‘s row number.Example:A = [ [ 1, 0, 0], [-1, 0, 3]]B = [ [ 7, 0, 0 ], [ 0, 0, 0 ], [ 0, 0,
標籤:分布式鎖在分布式應用其中是要經經常使用到的,主要是解決分布式資源訪問衝突的問題。 一開始考慮採用ReentrantLock來實現,可是實際上去實現的時候。是有問題的,ReentrantLock的lock和unlock要求必須是在同一線程進行,而分布式應用中,lock和unlock是兩次不相關的請求。因此肯定不是同一線程,因此導致無法使用ReentrantLock。 接下來就考慮採用自己做個狀態來進行鎖狀態的記錄,結果發現總是死結。細緻一看代碼,能不鎖死麼。 public
標籤:Write a function to find the longest common prefix string amongst an array of strings. Subscribe to see which companies asked this question比較每個字串的每個字元,直到第i個不同的字元,或者某個字串結束class Solution {public: string
標籤:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999. Subscribe to see which companies asked this question按照intger to roman 的思路,寫下面這道題,比較繞, 而且寫的不夠簡潔,而且修改了好幾次class Solution {public:
標籤:TreeTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescription You are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of
標籤:題目:Given n non-negative integers representing the histogram‘s bar height where the width of each bar is 1, find the area of largest rectangle in the histogram. Above is a histogram where width of each bar is 1, given height = [2,1,5,6,2,3].The