3404. Count Special Subsequences
Point: Turn multiplication to fraction Hard to realize “for r in range(4, n – 2): q = r – 2” part.
Solutions and Insights for LeetCode Problems
Point: Turn multiplication to fraction Hard to realize “for r in range(4, n – 2): q = r – 2” part.
Actually, brute force can work due to constrains. However, if we count the frequency every time, the time complexity will be O(n**3), which may…
Don’t forget mod when dealing with shifting. A negative number a: a % b = (a + b) % b Anyway, easy makes me…
Point is: we don’t have to remove items immediately from heap after rmv / edit operation. Do it when we are going to execTop.
This easy is easier than yesterday’s easy. New tech: str.find(sub) / str.rfind(sub). find the first/last index of sub. if sub == “”, return 0/n;…
You are given an array of positive integers nums. An array arr is called product equivalent if prod(arr) == lcm(arr) * gcd(arr), where: prod(arr)…