🚀 Day 88 of #100DaysOfCode | LeetCode Daily Solved LeetCode Problem #67 – Add Binary ➕💻✅ A clean fundamentals problem that reinforces how low-level operations really work under the hood. Simulating binary addition digit by digit with carry is simple, efficient, and elegant. Key Takeaways: -> Binary addition using carry logic -> Traversing strings from right to left -> Using StringBuilder for efficient string construction -> Handling edge cases when carry remains at the end Language: Java -> Runtime: 1 ms (Beats 99.65%) -> Memory: 43.90 MB Strong basics make complex problems easier. One day, one win. 🔥💻 #LeetCode #Java #Binary #Strings #ProblemSolving #100DaysOfCode
Java LeetCode #67 Binary Addition Solution
More Relevant Posts
-
🚀 Day 91 of #100DaysOfCode | LeetCode Daily Solved LeetCode Problem #693 – Binary Number with Alternating Bits 🔢💡✅ A clean and elegant bit manipulation problem. The trick is to XOR the number with its right shift and check if the result becomes all 1s — simple, fast, and effective. Key Takeaways: -> Using n ^ (n >> 1) to detect alternating patterns -> Leveraging highestOneBit() for boundary checks -> Writing concise, branch-free logic with bitwise ops -> Sometimes the smartest solutions are the shortest Language: Java -> Runtime: 0 ms (Beats 100%) -> Memory: 41.81 MB (Beats 97.08%) One more day, one more concept sharpened. 🔥 Onward to Day 92 💻🚀 #LeetCode #Java #BitManipulation #BinaryNumbers #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 90 of #100DaysOfCode | LeetCode Daily Solved LeetCode Problem #401 – Binary Watch ⌚💻✅ A fun problem that blends bit manipulation with simple iteration. The idea is to count set bits for hours and minutes and generate all valid time combinations. Key Takeaways: -> Smart use of Integer.bitCount() for counting LEDs -> Separating hours (0–11) and minutes (0–59) cleanly -> Formatting time output correctly (leading zeros matter!) -> Brute force done right with clear constraints Language: Java -> Runtime: 3 ms (Beats 91.19%) -> Memory: 43.45 MB (Beats 94.31%) Consistency builds confidence. 90 days in — still pushing forward. 🔥💻 #LeetCode #Java #BitManipulation #BinaryWatch #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 13 of #LeetCode Challenge 🔢 Problem: 1758 – Minimum Changes To Make Alternating Binary String Today’s problem was about converting a binary string into an alternating pattern with minimum changes. 💡 Key Insight: An alternating string can only start with either ‘0’ or ‘1’. So instead of trying many possibilities, I compared both patterns and counted mismatches — then returned the minimum. ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(1) ✨ This problem improved my thinking in: Pattern observation Optimization approach Writing clean and efficient Java code Consistency > Motivation 💪 #Day13 #Java #DSA #LeetCode #CodingJourney #FutureFullStackDeveloper
To view or add a comment, sign in
-
-
#Day28 of #365DaysOfCode Today’s LeetCode practice: 🔹 Word Search (LeetCode 79) Solved a backtracking problem where I had to check whether a given word exists in a 2D board by moving horizontally or vertically through adjacent cells. 💡 Key Insight: Start exploring from every cell. If the character matches the current letter of the word, move in all 4 possible directions. Mark the cell as visited and revert the change if the path doesn’t lead to a solution. On to Day 29 🔥 #LeetCode #Java #DSA #ProblemSolving #CodingJourney #Backtracking #Recursion
To view or add a comment, sign in
-
-
🚀 Day 38 of #100DaysOfLeetCode Today I solved "Container With Most Water" problem on LeetCode. 🔹 Difficulty: Medium 🔹 Concept Used: Two Pointer Technique 🔹 Language: Java 📌 Problem Summary: Given an array representing heights of vertical lines, the goal is to find two lines that together with the x-axis can contain the maximum amount of water. 💡 Approach: Instead of checking all possible pairs (O(n²)), I used the Two Pointer approach which reduces the time complexity to O(n). Steps: 1️⃣ Start with two pointers at the beginning and end of the array. 2️⃣ Calculate the area using the smaller height. 3️⃣ Move the pointer with the smaller height inward. 4️⃣ Track the maximum area during each step. 📊 Result: ✅ Runtime: 5 ms (Beats 81.86%) ✅ Memory: Beats 95.54% This problem was a great exercise to understand optimization using two pointers instead of brute force. Consistency is the key — moving forward one problem at a time! 💪 #LeetCode #100DaysOfCode #Java #DSA #CodingChallenge #ProblemSolving #SoftwareEngineering
To view or add a comment, sign in
-
-
Day 2/100 – LeetCode Challenge 🚀 Problem: #48 Rotate Image Difficulty: Medium Language: Java Approach: In-Place Rotation using Transpose + Row Reversal Time Complexity: O(n²) Space Complexity: O(1) 🔍 Key Insight: To rotate a matrix 90° clockwise without extra space: 1️⃣ First transpose the matrix (swap across diagonal). 2️⃣ Then reverse each row. This avoids creating a new matrix and satisfies the in-place constraint. 🧠 Solution Brief: Used nested loops to transpose the matrix by swapping arr[i][j] and arr[j][i]. Then reversed each row using two pointers (start and end). Combined both operations inside a rotate() method. Achieved full rotation with constant extra space. 📌 What I Learned: Matrix problems are more about pattern recognition than brute force. Understanding transformations (transpose + reverse) makes complex problems simple. Starting my 100 Days of LeetCode journey today 💪 Consistency > Motivation. #LeetCode #Day2 #100DaysOfCode #Java #DSA #Matrix #ProblemSolving #CodingJourney #MediumProblem
To view or add a comment, sign in
-
-
🚀 Day 20/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 350. Intersection of Two Arrays II Used sorting + two-pointer technique to efficiently find common elements appearing in both arrays while maintaining correct frequency. ⏱️ Time Complexity: O(n log n + m log m) 📦 Space Complexity: O(min(n, m)) (for storing the intersection) Strengthening understanding of array traversal and two-pointer pattern through consistent practice. 💪 Consistency keeps the progress moving 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🚀 Day 23/100 – LeetCode Challenge Today’s problem: Partitioning Into Minimum Number of Deci-Binary Numbers 🔹 Key Insight: The minimum number of deci-binary numbers required is equal to the maximum digit present in the string. 🔹 Approach: Traverse through each character in the string Convert it to integer (ch - '0') Track the maximum digit Return the maximum value 🔹 Time Complexity: O(n) 🔹 Space Complexity: O(1) ✨ Simple logic, but powerful observation! Instead of constructing numbers, we just analyze the digits. Consistency > Motivation 💪 #Day23 #100DaysOfCode #LeetCode #Java #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 98 of #100DaysOfCode Solved LeetCode #1356 – Sort Integers by The Number of 1 Bits ✅ A clean bit manipulation + sorting problem that rewards thinking beyond plain comparisons. Key Takeaways: -> Using Integer.bitCount() to count set bits efficiently -> Encoding sort priority directly into values for simplicity -> Leveraging built-in sorting for clean and fast solutions -> Small tricks can lead to elegant code ✨ Language: Java -> Runtime: 6 ms (Beats 93.70%) ⚡ -> Memory: 47.42 MB Almost there. Staying consistent till the end 💻🔥 #LeetCode #Java #BitManipulation #Sorting #ProblemSolving #DSA #100DaysOfCode
To view or add a comment, sign in
-
-
LeetCode Problem || Check if Binary String Has at Most One Segment of Ones(1784)🚀 we need to check: The string should have only one continuous block of '1's. After a '0' appears, '1' should never appear again. ✨ Insight: Instead of manually counting segments using loops, we can simply check if "01" exists in the string. 📌 Time Complexity: O(n) Practicing problems like these helps improve pattern recognition and problem-solving efficiency. #LeetCode #DSA #Java #CodingPractice #ProblemSolving
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development