4000 LeetCode problem solution
LeetCode 4000 Largest Integer With Given Digit Sum is a simple greedy problem. To build the largest possible number, we place the largest digits first while keeping the required digit sum.
Read moreLeetCode 4000 Largest Integer With Given Digit Sum is a simple greedy problem. To build the largest possible number, we place the largest digits first while keeping the required digit sum.
Read moreLeetCode 3870 and 3871 problems look almost the same, but the larger constraints change the solution. This is a good example of why you should always ask about the problem constraints.
Read moreLeetCode 3871 Count Commas in Range II solution in Elixir. In this solution the recursion replaces the C++ loop. Since it uses tail recursion, the Elixir/Erlang VM can execute it without accumulating stack frames.
Read moreLeetCode 3871 Count Commas in Range II solution. It extends the 3870 problem to much larger numbers. Instead of counting numbers, we count each comma level separately in O(log n) time. But for the given constraints, the algorithm performs at most five iterations and O(1) time.
Read moreLeetCode 3870 Count Commas in Range solution in Elixir. The easy solution with the O(1) time and space complexities implemented in Elixir.
Read more