Math
LeetCode 3824: Minimum K to Reduce Array Within Limit
·2 mins
LeetCode
Medium
Binary-Search
Math
LeetCode 3824 note: binary search on k with a monotonic check; the upper bound must reach n because there are at least n operations
LeetCode 976: Largest Perimeter Triangle
·2 mins
LeetCode
Easy
Math
Greedy
Sorting
Geometry
Array
LeetCode 976 note: after sorting, check consecutive triples from the largest down; the first with a + b > c gives the largest perimeter
LeetCode 633: Sum of Square Numbers
·2 mins
LeetCode
Medium
Two-Pointers
Math
Binary-Search
LeetCode 633 note: converge a from 0 and b from isqrt(c); shrink b when the sum is too big and grow a when it is too small; watch for 0, a == b, and floating-point square roots
LeetCode 1040: Moving Stones Until Consecutive II
·3 mins
LeetCode
Medium
Sliding-Window
Math
Sorting
Array
LeetCode 1040 note: max moves = total gaps minus the edge gap the first move wastes; min moves uses a length-n window holding the most stones, with a special case of 2 when n - 1 stones are already consecutive and one is far away
LeetCode 3805: Count Caesar Cipher Pairs
·2 mins
LeetCode
Medium
Math
Hash-Table
String
Counting
LeetCode 3805 note: shift each string so its first letter is a, making Caesar-equivalent strings identical, then count pairs per normalized form
LeetCode 1401: Circle and Rectangle Overlapping
·2 mins
LeetCode
Medium
Math
Geometry
LeetCode 1401 note: the rectangle’s nearest point to the center is the center clamped into the rectangle; they overlap when that point is within the radius
LeetCode 2269: Find the K-Beauty of a Number
·2 mins
LeetCode
Easy
Sliding-Window
Math
String
LeetCode 2269 note: convert the number to a string and check every length-k substring; 0 cannot be a divisor
LeetCode 1281: Subtract the Product and Sum of Digits of an Integer
·1 min
LeetCode
Easy
Math
LeetCode 1281 note: walk the digits once, accumulating product and sum, and return product minus sum
LeetCode 1512: Number of Good Pairs
·1 min
LeetCode
Easy
Math
Hash-Table
Counting
Array
LeetCode 1512 note: count while scanning; each number pairs with every earlier equal number, so add its current count to the answer
LeetCode 1486: XOR Operation in an Array
·1 min
LeetCode
Easy
Math
Bit-Manipulation
LeetCode 1486 note: generate start + 2i by definition and XOR them together
LeetCode 2469: Convert the Temperature
·1 min
LeetCode
Easy
Math
LeetCode 2469 note: apply the formulas directly, Kelvin = C + 273.15 and Fahrenheit = C × 1.8 + 32
LeetCode 2413: Smallest Even Multiple
·1 min
LeetCode
Easy
Math
Number-Theory
LeetCode 2413 note: lcm(2, n), which is n when n is even and 2n when odd