原创 爲什麼父進程不處理標準輸入輸出子進程會掛起(Java)?

最近寫Java的多進程程序時遇到一個奇怪的問題,發現程序運行一段時間以後會自動掛起。按道理來說子進程和父進程之間是沒有太大的關係的,父進程只是用於開啓一個新的子進程,之後就沒怎麼聯繫了。最後查到了stackoverflow上面的

原创 關於線程通信的通俗解釋

線程通信主要分爲以下幾個部分,下面通過生活中圖書館借書的例子簡單講解以下: 通過共享對象通信 加入圖書館只有一本《java併發編程實戰》,小A早上的時候把這本書給借走了,然後下午小B去圖書館去找這本書,這時候小A和小B是兩個線程

原创 Rotate List

原題: Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->

原创 Unique Paths

原題如下(鏈接:https://leetcode.com/problems/unique-paths/): A robot is located at the top-left corner of a m x n grid (m

原创 Reorder List

原題如下: Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-plac

原创 Spiral Matrix

原題: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For e

原创 Path Sum II

原題: Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum. For exa

原创 Gerrit簡單使用

Gerrit參考文檔: http://gerrit-documentation.googlecode.com/svn/Documentation/2.4.2/index.html 權限控制: http://openwares

原创 Search a 2D Matrix

原題如下: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following pro

原创 Search for a Range

水題一道: Given a sorted array of integers, find the starting and ending position of a given target value. Your algori

原创 Reverse Linked List II

原題: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5-

原创 Ugly Number II(求第N個醜數)

這個應該是微軟的一道面試題,首先需要明白醜數的概念。1是一個特殊的醜數,其次只含有2,3,5質因數的數被定義爲醜數。 關於解題的思路可以參考: http://www.geeksforgeeks.org/ugly-numbers

原创 Python中爲什麼沒有++和--(自增/減)

這兩天看了一些網上各大互聯網公司的面試題,發現騰訊特別喜歡考察++和–以及移位運算相關的內容。C++相對來說還是比較熟悉的,對於這類問題只要記住運算符的優先級一般問題不大。由於也會經常用Python,突然覺得Python中爲什麼

原创 Sliding Window Maximum

原題: Given an array nums, there is a sliding window of size k which is moving from the very left of the array to th

原创 Group Anagrams

原題: Given an array of strings, group anagrams together. For example, given: [“eat”, “tea”, “tan”, “ate”, “nat”, “bat”]