Feb 16 · 7 min read · Binary Exponentiation : is a fast method to calculate powers like aⁿ , without multiplying a again and again n times. Instead of O(n) multiplications, it works in O(log n) time. Idea Behind Binary Exponentiation We use two simple observations : If po...
Join discussion
Feb 14 · 4 min read · Sweep Line Ideas : Question :-Given N Intervals Of The Form -> L,RN<=10^5L,R <= 10^9 1 - Find Union Of All :The union of two sets contains all elements from both sets, with common elements included only once Example :Intervals : [1,5] [3,7] Numb...
Join discussion
Feb 13 · 9 min read · Interval : An Interval is a continuous range of values between a start point and an end point on a lineExample :[1, 5) means the interval starts at 1 and goes up to 5, but does not include 5 Event : An Event is a specific point where an interval sta...
Join discussion
Feb 11 · 7 min read · Contribution Technique Contribution Technique is an optimization method in Data Structures & Algorithms where we calculate how much each element contributes to the final answer instead of generating all subarrays.It helps reduce time complexity from ...
Join discussion
Feb 10 · 4 min read · Prefix Sum It is a simple yet powerful technique that allows to perform fast calculation on the sum of elements in a given range (called contiguous segments of array) A Prefix Sum Array stores the cumulative sum of elements from the start up to the c...
Join discussion
Feb 9 · 16 min read · What is modulo : Modulo arithmetic is a mathematical operation that deals with remainders. When dividing one integer by another, we typically get a quotient and a remainder. This concept is formalized with the notation n%m, where n is the dividend an...
Join discussion