🚀 Day 80/100 – LeetCode Daily Challenge 🧠 Problem: Concatenated Binary 📌 Difficulty: Medium Today’s challenge was to concatenate the binary representations of numbers from 1 to n and return the decimal value of the resulting binary string. 💡 Approach: Instead of actually forming the string, I used bit manipulation to simulate the concatenation: For each number i, compute its bit length using floor(log2(i)) + 1. Left shift the current result by that many bits and add i, applying modulo at each step to prevent overflow. This gives an efficient O(n) solution in both time and space. 📊 Result: ✅ 403 / 403 test cases passed ⚡ Runtime: competitive and clean This problem was a great reminder of how bitwise operations can elegantly solve problems that seem string-heavy at first glance. #LeetCode #CodingChallenge #100DaysOfCode #Day80 #Java #BitManipulation #ProblemSolving #Tech #Programming #DailyCoding #DevCommunity #WomenWhoCode #CodeNewbie
LeetCode Challenge: Concatenated Binary Solution
More Relevant Posts
-
🚀 Day 28/60 — LeetCode Discipline Problem Solved: Number of 1 Bits (Hamming Weight) Difficulty: Easy Today’s problem explored the fundamentals of bit manipulation, one of the most powerful and efficient areas in programming. The task was to count the number of set bits (1s) in the binary representation of a number. Instead of converting the number to a binary string, the solution uses bitwise operations to efficiently extract each bit. This approach highlights how low-level operations can lead to high-performance solutions with minimal overhead. 💡 Focus Areas: • Strengthened bit manipulation concepts • Practiced use of bitwise AND (&) • Understood right shift operations (>>>) • Improved efficiency by avoiding extra space • Built deeper understanding of binary representation ⚡ Performance Highlight: Achieved 0 ms runtime (100% performance). Mastering bits is like learning the language of machines — once you understand it, everything becomes faster and sharper. #LeetCode #60DaysOfCode #100DaysOfCode #DSA #BitManipulation #Algorithms #ProblemSolving #CodingJourney #SoftwareEngineering #Java #Developers #TechGrowth #Consistency #LearnToCode
To view or add a comment, sign in
-
-
🚀 Day 87/100: #LeetCodeChallenge 📌 Problem: Minimum Swaps to Arrange a Binary Grid Today’s challenge was all about optimizing space and time — and it paid off! 🎯 I tackled the problem by first counting trailing zeros in each row, then simulating the minimum number of adjacent swaps required to bring rows with enough trailing zeros to the top. ✅ Runtime: 2 ms (Beats 96.23%) ✅ Memory: 49.54 MB (Beats 73.13%) 📈 Key Insight: The core idea is to ensure that for each row i (0-based from top), it must have at least n - i - 1 trailing zeros. By precomputing trailing zero counts and swapping rows upward as needed, we can achieve the target configuration with minimal swaps. 💡 Takeaway: Breaking down the problem into smaller subproblems — like counting zeros first and then swapping — helped simplify the logic and optimize performance. On to the next! 🔥 #100DaysOfCode #CodingJourney #Java #Algorithms #ProblemSolving #Grid #Efficiency #DevCommunity #LeetCode #CodeNewbie #Programming
To view or add a comment, sign in
-
-
🚀 Day 16 of My LeetCode Journey Today, I solved LeetCode Problem #747 – Largest Number At Least Twice of Others. 🔍 Problem Summary: Given an array of integers, we need to find whether the largest element is at least twice as much as every other number. If yes, return its index; otherwise, return -1. 💡 Approach I Used: First, find the largest and second largest elements in the array. Then check if the largest element is at least twice the second largest. If yes, return the index of the largest element. 🧠 Key Learning: This problem improved my understanding of: Array traversal Maintaining multiple variables (max & second max) Writing optimized O(n) solutions 📈 Progress: Consistency is the key 🔑 — improving step by step every day. #LeetCode #DSA #Java #CodingJourney #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Day 75/200 – LeetCode Challenge Given a string of digits, the task is to generate all possible valid IP addresses by inserting dots. Sounds simple, but the challenge lies in handling. Try placing dots at every possible position. Validate each segment before moving forward. Prune invalid paths early to save time. Backtracking becomes powerful when combined with early pruning. Instead of exploring all possibilities, we cut off invalid paths immediately, making the solution efficient. Problems like this strengthen recursion + validation thinking. The more you practice, the better you get at spotting patterns. #Day75 #LeetCode #CodingChallenge #Java #200DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 25/100 – LeetCode DSA Challenge ✅ Problem Solved: Third Maximum Number Today’s problem focused on finding the third distinct maximum number in an array. If it doesn’t exist, we return the maximum number. 🔍 Key Learnings: • Importance of handling distinct values (duplicates ignored) • Efficient tracking of top 3 values without sorting • Achieving O(n) time complexity using a single pass • Better understanding of edge cases like negative numbers 💡 Approach: Instead of sorting (O(n log n)), I used three variables to track the first, second, and third maximum values while iterating through the array once. 📌 Example: Input: [2,2,3,1] Output: 1 🎯 This problem improved my thinking on optimization and clean logic building. #Day25 #100DaysOfCode #DSA #LeetCode #Java #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
🔥 Day 53 of #100DaysOfCode Solved – Number of Steps to Reduce a Number to Zero 🔍 What I did: Simulated the process by repeatedly checking whether the number is even or odd. If even, divided by 2; if odd, subtracted 1 — counting each step until the number became zero. 💡 Key Learning: Strengthened understanding of conditional logic (even vs odd) Practiced step-by-step simulation problems Learned a cleaner approach using bit manipulation (num & 1) ⚡ Result: ✅ Accepted ⚡ Efficient and clean solution 🎯 Takeaway: Breaking a problem into simple rules and simulating them step-by-step can make even tricky problems easy to solve. #Day53 #LeetCode #Java #ProblemSolving #CodingJourney #100DaysOfCode #DSA
To view or add a comment, sign in
-
-
🚀 Day 53 of #100DaysOfLeetCode Solved: Next Greater Element (Leetcode 496) Today’s problem was a great reminder of how powerful Monotonic Stack can be for optimization. 🔹 Approach: Used a stack to maintain decreasing elements Mapped each element to its next greater using a HashMap Reduced time complexity from O(n²) → O(n) 🔹 Key Learning: Small mistakes in conditions (like missing a !) can completely break logic. Attention to detail matters just as much as understanding the concept. 🔹 Complexity: Time: O(n + m) Space: O(n) Consistency > Perfection. Showing up daily and improving step by step. #LeetCode #DSA #Java #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
Day 50/75 — Climbing Stairs Today’s problem was a classic dynamic programming question — counting the number of distinct ways to reach the top. Approach: • Recognize it as a Fibonacci pattern • Each step = sum of previous two steps • Optimize space using two variables instead of an array Key logic: int current = prev1 + prev2; prev2 = prev1; prev1 = current; Time Complexity: O(n) Space Complexity: O(1) A fundamental problem that builds strong intuition for DP and recurrence relations. Halfway there — consistency paying off 🔥 50/75 🚀 #Day50 #DSA #DynamicProgramming #Java #Algorithms #LeetCode
To view or add a comment, sign in
-
-
After a long time, I solved a hard problem on LeetCode today. Small wins like this keep the learning journey exciting. 🚀 🚀 #Day82 of #100DaysOfCodeChallenge Today’s problem was a challenging one focused on Linked Lists and pointer manipulation. 📌 Problem: Reverse Nodes in k-Group (Hard) Given a linked list, the task is to reverse nodes in groups of size k. If the remaining nodes are fewer than k, they stay as they are. 🧠 Key Idea: Traverse the list and count k nodes. If k nodes exist, recursively process the remaining list. Reverse the current group of k nodes. Connect the reversed group with the result of the recursive call. Problems like this really test your understanding of how nodes connect and move inside a linked list. Consistency continues. One step closer to becoming better at problem solving every day. 💪 #100DaysOfCode #Day82 #LeetCode #DSA #LinkedList #Java #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
One thing we believe strongly is that a programming language is only as good as the projects you can build with it. In preparation for the v0.0.7 release, I will be publishing a Project Examples section on chuks.org. 10 complete, runnable projects organized by difficulty: Beginner • Hello API • Task Tracker CLI including file I/O, enums, error handling Intermediate • URL Shortener with Redis, middleware, and rate limiting • User Service with MongoDB, JWT auth, repository pattern • Real-Time Chat with WebSockets, channels, broadcast • AI Chat Agent with LLM integration, RAG, and tool calling Advanced • Job Scheduler with cron, worker pools, graceful shutdown • Microservice Pair with gRPC, OpenTelemetry, NATS • GraphQL API with typed resolvers, and DataLoader pattern. Every project uses chuks run or compiles to a native binary with chuks build. No separate toolchain, no boilerplate. Chuks v0.0.7, our biggest release yet, is coming early April. It includes a built-in package manager, watch mode, route groups, 83 math functions, and full generic monomorphization in the AOT compiler. 80 files changed, +7,806 lines. - Visit chuks.org to get started. - Follow ChuksLang on X: https://x.com/Chukslang - Join the Cleset community for early tester access: https://lnkd.in/exgQCvrK #ProgrammingLanguages #BackendDevelopment #BuildInPublic #ChuksLang #softwareEngineering #SoftwareEngineer #Programming
To view or add a comment, sign in
Explore related topics
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