90-Day Coding Challenge: Fast Exponentiation with Binary Exponentiation

Day 58 of My 90-Day Coding Challenge Today was a step back toward real problem solving. Worked on a problem that required Fast Exponentiation (Binary Exponentiation) — not something you can brute force your way through. Key learning: • When constraints are large, O(n) thinking fails • You must reduce the problem using logarithmic approaches • Repeated squaring is not just an optimization — it’s the only viable way Instead of multiplying step by step, the idea is to: • Square the base • Halve the exponent • Build the answer conditionally This reduces time complexity from O(n) → O(log n). What stood out today: Recognizing when a problem is actually about math + patterns, not loops. Back to building momentum. #90DaysOfCode #DSA #Java #BinaryExponentiation #ProblemSolving #LeetCode #Optimization

  • text

To view or add a comment, sign in

Explore content categories