BLBrian Liinleetcode-writeup-brianlii.hashnode.dev·Feb 4 · 1 min readLeetcode Writeup 3010. Divide an Array Into Subarrays With Minimum Cost IProblem Description The cost of the partition [0…i-1][i…j-1][j…n-1] is nums[0]+nums[i]+nums[j]. To obtain minimum cost, two “separator “ nums[i] and nums[j] are the smallest and the second-smallest element. Algorithm Use two variables min1 and min2 t...00
BLBrian Liinleetcode-writeup-brianlii.hashnode.dev·Feb 2 · 2 min readLeetcode Writeup 2976. Minimum Cost to Convert String IProblem Description Observations Observation 1: Each position in the string can be handled independently. The total minimum cost is the sum of the minimum conversion cost from source[i] to target[i] over all indices. Observation 2: A direct convers...00
BLBrian Liinleetcode-writeup-brianlii.hashnode.dev·Dec 16, 2025 · 1 min readLeetcode Writeup 74. Search a 2D MatrixProblem Description Given a m x n integer matrix. Each row of the matrix is non-decreasing. The first element of each row is greater than the last element of the previous row.Given an integer target, return true if and only if target is in the matrix...00