Solve a given equation and return the value ofContinue reading “[Leetcode]640. Solve the Equation”`x`

in the form of string "x=#value". The equation contains only '+', '-' operation, the variable`x`

and its coefficient. If there is no solution for the equation, return "No solution". If there are infinite solutions for the equation, return "Infinite solutions". If there is exactly one solution for the equation, we ensure that the value of`x`

is an integer.

## [Leetcode]1558. Minimum Numbers of Function Calls to Make Target Array

Your task is to form an integer arrayContinue reading “[Leetcode]1558. Minimum Numbers of Function Calls to Make Target Array”`nums`

from an initial array of zeros`arr`

that is the same size as`nums`

. Return the minimum number of function calls to make`nums`

from`arr`

. The answer is guaranteed to fit in a 32-bit signed integer.

## [Leetcode]739. Daily Temperatures

Given a list of daily temperaturesContinue reading “[Leetcode]739. Daily Temperatures”`T`

, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which this is possible, put`0`

instead. For example, given the list of temperatures`T = [73, 74, 75, 71, 69, 72, 76, 73]`

, your output should be`[1, 1, 4, 2, 1, 1, 0, 0]`

.Note:The length of`temperatures`

will be in the range`[1, 30000]`

. Each temperature will be an integer in the range`[30, 100]`

.

## [Leetcode]1574. Shortest Subarray to be Removed to Make Array Sorted

Given an integer arrayContinue reading “[Leetcode]1574. Shortest Subarray to be Removed to Make Array Sorted”`arr`

, remove a subarray (can be empty) from`arr`

such that the remaining elements in`arr`

arenon-decreasing. A subarray is a contiguous subsequence of the array. Returnthe length of the shortest subarray to remove.

## [Leetcode]835. Image Overlap

Two imagesContinue reading “[Leetcode]835. Image Overlap”`A`

and`B`

are given, represented as binary, square matrices of the same size. (A binary matrix has only 0s and 1s as values.) We translate one image however we choose (sliding it left, right, up, or down any number of units), and place it on top of the other image. After, theoverlapof this translation is the number of positions that have a 1 in both images. (Note also that a translation doesnotinclude any kind of rotation.) What is the largest possible overlap?Notes:`1 <= A.length = A[0].length = B.length = B[0].length <= 30`

`0 <= A[i][j], B[i][j] <= 1`

## [Leetcode]714. Best Time to Buy and Sell Stock with Transaction Fee

This series of **Buy and Sell Stock I~VI** on Leetcode is a great practice for Dynamic Programming – State Machine. Therefore I prepared blogs for each of them and hopefully it would help you to understand them better. You can find the relations of them at the bottom and feel free to leave any comments.

- [Leetcode]121. Best Time to Buy and Sell Stock
- [Leetcode]122. Best Time to Buy and Sell Stock II
- [Leetcode]123. Best Time to Buy and Sell Stock III
- [Leetcode]188. Best Time to Buy and Sell Stock IV
- [Leetcode]309. Best Time to Buy and Sell Stock with Cooldown
- [Leetcode]714. Best Time to Buy and Sell Stock with Transaction Fee

## [Leetcode]309. Best Time to Buy and Sell Stock with Cooldown

This series of **Buy and Sell Stock I~VI** on Leetcode is a great practice for Dynamic Programming – State Machine. Therefore I prepared blogs for each of them and hopefully it would help you to understand them better. You can find the relations of them at the bottom and feel free to leave any comments.

- [Leetcode]121. Best Time to Buy and Sell Stock
- [Leetcode]122. Best Time to Buy and Sell Stock II
- [Leetcode]123. Best Time to Buy and Sell Stock III
- [Leetcode]188. Best Time to Buy and Sell Stock IV
- [Leetcode]309. Best Time to Buy and Sell Stock with Cooldown
- [Leetcode]714. Best Time to Buy and Sell Stock with Transaction Fee

## [Leetcode]1286. Iterator for Combination

Design an Iterator class, which has: A constructor that takes a stringContinue reading “[Leetcode]1286. Iterator for Combination”`characters`

ofsorted distinctlowercase English letters and a number`combinationLength`

as arguments. A functionnext()that returns the next combination of length`combinationLength`

inlexicographical order. A functionhasNext()that returns`True`

if and only if there exists a next combination.Constraints:`1 <= combinationLength <= characters.length <= 15`

There will be at most`10^4`

function calls per test. It's guaranteed that all calls of the function`next`

are valid.