Binary Gap Challenge Solved in Java

🚀 Day 66 / 100 Days of LeetCode Challenge ✅ Problem Solved: Binary Gap 💡 Goal: Find the longest distance between two consecutive 1s in the binary representation of a given integer. 🧠 Thought Process: Removed trailing zeros to start from the first 1. Handled edge case where number is 1 → return 0. Iterated through bits, tracking gap length between 1s. Updated max gap whenever a 1 was found. 📈 Result: ⚡ Runtime: 0 ms (Beats 100% 🎉) 💾 Memory: 42.56 MB (Beats 14.06%) 📝 Key Takeaway: Efficient bit manipulation can drastically simplify problems involving binary representations. Always consider using bitwise operators for performance gains! #LeetCode #100DaysOfCode #CodingChallenge #Java #BitManipulation #ProblemSolving #TechJourney #DeveloperLife #WomenInTech #CodeNewbie #Programming #DailyCoding #BinaryGap #LearnToCode #DSA #Algorithms

  • graphical user interface, application

To view or add a comment, sign in

Explore content categories