🚀 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
Java LeetCode 1356: Sort Integers by 1 Bits
More Relevant Posts
-
🚀 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 31/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 69. Sqrt(x) Used the Binary Search approach to find the integer square root without using built-in power functions. The search space is reduced by checking mid * mid against x. ⏱️ Time Complexity: O(log n) 📦 Space Complexity: O(1) Strengthening problem-solving skills with binary search patterns on answer space. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🎯 Day 100 of #100DaysOfCode 🔥 What a way to wrap it up! Solved LeetCode #3666 – Minimum Operations to Equalize Binary String ✅ A problem that blends math, parity logic, and careful case analysis—not your usual binary flip question. Key takeaways: -> Count-based optimization over brute force -> Handling even/odd operation patterns smartly -> Early exits = cleaner & faster logic -> Thinking in terms of operations feasibility rather than simulation 🧠 Language: Java -> Runtime: 0 ms (Beats 83.87%) -> Memory: 47.90 MB 100 days. Countless problems. One habit built: consistency 💪 Onward to harder problems and deeper concepts 🚀 #LeetCode #Java #DSA #BinaryStrings #ProblemSolving #Consistency #100DaysChallenge
To view or add a comment, sign in
-
-
Day 89/100 – LeetCode Challenge ✅ Problem: #459 Repeated Substring Pattern Difficulty: Easy Language: Java Approach: Substring Division Check Time Complexity: O(n²) worst case Space Complexity: O(n) Key Insight: A string can be formed by repeating its substring if the substring length divides the string length. Check all divisors of length from largest to smallest for efficiency. Solution Brief: Iterated i from l/2 down to 1 (larger substrings first). If l % i == 0, substring length divides string length. Constructed repeated pattern by appending substring m = l/i times. Compared constructed string with original. #LeetCode #Day89 #100DaysOfCode #String #Java #Algorithm #CodingChallenge #ProblemSolving #RepeatedSubstring #EasyProblem #Substring #Pattern #DSA
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
-
-
Day 7/100 – LeetCode Challenge Problem: Palindrome Number Today’s problem focused on number manipulation without converting the integer into a string. Approach: If number is negative → return false Reverse the digits using modulo (% 10) and division (/ 10) Compare reversed number with original number Logic Used: Extract last digit: rem = x % 10 Build reversed number: rev = rev * 10 + rem Remove last digit: x = x / 10 Complexity: Time: O(log₁₀ n) Space: O(1) Key takeaway: Problems involving digits can often be solved mathematically without string conversion. #100DaysOfCode #LeetCode #DSA #Java #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
#day328 of #1001daysofcode problem statement (1758): Minimum Changes To Make Alternating Binary String An alternating binary string can only follow two patterns: "010101..." or "101010...". I counted the number of changes required to convert the string into both patterns and returned the minimum of the two. ⏱Time Complexity: O(n) 🧠Space Complexity: O(1) Consistency check ✅ One LeetCode problem a day to sharpen problem-solving skills. #1001DaysOfCode #DSA #Java #LeetCode #ProblemSolving Shivam Mahajan #leetcode
To view or add a comment, sign in
-
-
🚀 Day 18/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 1528. Shuffle String Used a direct indexing approach by placing each character at its correct position using the given indices array. ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(n) A simple yet important problem to strengthen understanding of arrays and index mapping. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
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
-
-
🚀 Day 41/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 3427. Sum of Variable Length Subarrays Used a nested loop approach to calculate subarray sums for each index by dynamically determining the starting point using max(0, i - nums[i]). ⏱️ Time Complexity: O(n²) 📦 Space Complexity: O(1) Strengthening understanding of subarray problems and index-based range calculations. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
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