2364. Count Number of Bad Pairs
Permutation: in order. n!/(n – m)! Combination: order not considered. n!/((n – m)! * m!) Key point of this problem is to transfer i…
Permutation: in order. n!/(n – m)! Combination: order not considered. n!/((n – m)! * m!) Key point of this problem is to transfer i…
Point: Turn multiplication to fraction Hard to realize “for r in range(4, n – 2): q = r – 2” part.
Don’t forget mod when dealing with shifting. A negative number a: a % b = (a + b) % b Anyway, easy makes me…
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)…