Problem: Given a rotated sorted array, recover the sorted array in-place.
For example:
{ 4, 5, 1, 2, 3 } –> {1, 2, 3, 4, 5}
Challenge requirement:
in-palce, O(1) extra space and O(n) time
Continue reading
Problem: Given a rotated sorted array, recover the sorted array in-place.
For example:
{ 4, 5, 1, 2, 3 } –> {1, 2, 3, 4, 5}
Challenge requirement:
in-palce, O(1) extra space and O(n) time
Continue reading
What is Apache Storm?
Requirement: Design a system to take user-provided URL and transform them to a shortened URL that redirect back to original.
How to evaluation a system design? Continue reading
In the previous post (Synchronized vs ReentrantLock in Java) , we have discussed the difference between synchronized and ReentrantLock. The keyword synchronized can be widely used in many multi-threaded environments. However, there are some drawbacks when using synchronized. The use of keyword synchronized provides access to the implicit monitor lock associated with every object, but forces all lock acquisition and release to occur in a block-structured way: when multiple locks are acquired they must be released in the opposite order, and all locks must be released in the same lexical scope in which they were acquired. In short, when the keyword synchronized locks a block, and a thread is in the block, other threads have to wait and will be blocked until that thread exits the block. It will slow down the performance. In some situations, it may leads to a deadlock. Continue reading
1 2 3 |
find . -type f -mtime +1 -exec /bin/rm -f {} + |
or
1 2 3 |
find . -mindepth 1 -mtime +3 -delete |
Since Spring 3.0, annotation support for both task scheduling and asynchronous method execution has been added. The post will give a demo of @Async annotation and its uses. Continue reading
To add a new column called age to the clients table, use the following SQL statement: Continue reading
Question:
I have a strange error when starting mysqld service:
1 2 3 |
Another MySQL daemon already running with the same unix socket. |
Given a collection of integers that might contain duplicates, nums, return all possible subsets.
Note:
1) Elements in a subset must be in non-descending order.
2) The solution set must not contain duplicate subsets.
Continue reading
Given a set of distinct integers, nums, return all possible subsets.
Note: