LeetCode 22. Generate Parentheses Elixir solution
The Elixir solution uses Backtracking with recursion to generate only valid parentheses combinations. The open and close counters track how many opening and closing parentheses have been used. The Time complexity is O(n * Cₙ) and the auxiliary Space complexity is O(n).
Read moreLeetCode 20 Valid Parentheses Elixir solution
LeetCode 20. Valid Parentheses is a classic problem for using a list as a Stack data structure, recursion, and pattern matching to keep track of opening brackets and validate them in the correct order. Time and Space Complexity are both O(n).
Read moreLeetCode 3525 Elixir solution
LeetCode 3525. Find X Value of Array II solution in Elixir using Segment Tree, Prefix Product, and Modular Arithmetic patterns. Each tree node stores the segment product modulo k and prefix counts for every possible remainder. Point updates modify the array efficiently, while range queries over [start, n - 1] return the number of prefixes whose product modulo k equals x. Since k <= 5, each merge takes constant time. Time complexity is O(n + q * log n), Space complexity is O(n).
Read moreLeetCode 3524 Elixir solution
LeetCode 3524 Find X Value of Array I uses Dynamic Programming and Modular Arithmetic technique to count subarrays by their product remainder. Instead of calculating full products, the solution keeps only k remainder states and updates them for each element. With k <= 5, the algorithm runs in O(n * k) time and uses O(k) extra space.
Read moreLeetCode 1401 Elixir solution
LeetCode 1401 Circle and Rectangle Overlapping Elixir solution using Geometry and Clamping patterns to find the closest point and detect overlap. O(1) time and O(1) space complexity.
Read more