Concurrency
Semaphore Semaphore Conceptually, a semaphore maintains a set of permits. Semaphore(int): a bowl of marbles acquire(): takes one marble from the bowl; waits if there are none release(): ad...
Semaphore Semaphore Conceptually, a semaphore maintains a set of permits. Semaphore(int): a bowl of marbles acquire(): takes one marble from the bowl; waits if there are none release(): ad...
Edit Distance public int minDistance(String word1, String word2) { int n1 = word1.length(), n2 = word2.length(); // dp[i][j]: word1.substring(0, i) -> word2.substring(0, j) int[][]...
Underscores in Numeric Literals In Java SE 7 and later, any number of underscore characters (_) can appear anywhere between digits in a numerical literal. This feature enables you, for example, to...
Array Empty array: int[] arr1 = new int[0]; int[][] arr2 = new int[0][0]; ArrayDeque Null elements are prohibited. Arrays public static <T> List<T> asList(T… a): fixed-size, mu...
Binary Search public int search(int[] nums, int target) { int low = 0, high = nums.length - 1; while (low <= high) { int mid = (low + high) >>> 1; if (nums[mid]...