↓ 1 callersMethodlengthOfLIS2DP. O(n^2) time, O(n) space. We can store the longest increasing subseqence lengths of [0, i-1]. Now at index i, if nums[i] is larger than nums[x], it
src/main/java/com/freetymekiyan/algorithms/level/medium/LongestIncreasingSubsequence.java:65
↓ 1 callersMethodmaxSumOfThreeSubarraysA: [1,2,1,2,6,7,6,1] -> B: [3,3,3,8,13,13,7] B is the k-interval sum. The index of element in B is the starting index of the subarray in A. It makes t
src/main/java/com/freetymekiyan/algorithms/level/hard/MaximumSumOf3NonOverlappingSubarrays.java:40
↓ 1 callersMethodnormalizeuse ax + by = c to represent a line and a|b|c as a key for that line a, b, c should be normalized, how? <p> special case, vertical, horizontal
src/main/java/com/freetymekiyan/algorithms/level/hard/MaxPointsOnALine.java:66
↓ 1 callersMethodnormalizeuse ax + by = c to represent a line and a|b|c as a key for that line a, b, c should be normalized, how? special case, vertical, horizontal
src/main/java/com/freetymekiyan/algorithms/level/hard/MaxPoints.java:61
↓ 1 callersMethodnumberOfArithmeticSlicesIf we find an arithmetic array of length n, the number of slices it has is: (n - 2) (n - 1) / 2 E.g. [1, 2, 3, 4], n = 4, # of arithmetic slices = (4-
src/main/java/com/freetymekiyan/algorithms/level/medium/ArithmeticSlices.java:50