Day 8 of #100DaysOfLeetCode 💻✅ Solved Number of 1 Bits (Hamming Weight) in Java. Approach: Used bitwise AND (n & 1) to check if the last bit is set Counted set bits while traversing through all bits Used unsigned right shift (>>>) to safely handle positive and large integers Continued until the number becomes zero Key Learning: ✓ Strengthened understanding of bit manipulation ✓ Learned how unsigned shift helps avoid sign-related issues Learning and improving one problem every single day 🚀 #Java #LeetCode #BitManipulation #ProblemSolving #CodingJourney #100DaysOfCode #DSA
Java Bit Manipulation: Number of 1 Bits Solution
More Relevant Posts
-
Day 12 of #100DaysOfLeetCode 💻✅ Solved #326. Power of Three problem in Java. Approach: • Checked if the number is less than or equal to zero (not a power of three) • Continuously divided the number by 3 while it was divisible • Verified whether the final value becomes 1 • Avoided recursion and used iteration for better efficiency Performance: ✓ Runtime: 8 ms (Beats 86.60% submissions) ✓ Memory: 46.35 MB Key Learning: ✓ Strengthened understanding of number divisibility logic ✓ Learned efficient validation of power-based numbers ✓ Improved problem-solving using iterative reduction Learning one problem every day 🚀 #Java #LeetCode #DSA #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 DSA Day 5 / 100 Solved the Two Sum problem on LeetCode using Java. Logic : • Go through the array one number at a time • For each number, check what value is needed to reach the target • Store each number with its index in a HashMap • If the needed value is already stored, we’ve found the answer #DSA #100DaysOfCode #Java #LeetCode #BeginnerDSA #LearningStepByStep #Consistency
To view or add a comment, sign in
-
-
Day 27 of #100DaysOfLeetCode 💻✅ Solved #83. Remove Duplicates from Sorted List on LeetCode using Java. Approach: • Utilized the fact that the linked list is already sorted • Traversed the list using a single pointer • Compared current node value with next node value • If duplicate found, skipped the next node by updating links • Continued traversal until reaching the end of the list Performance: ✓ Runtime: 0 ms (Beats 100% submissions) ✓ Memory: 45.30 MB (Beats 85.70% submissions) Key Learning: ✓ Understood how sorting simplifies duplicate removal logic ✓ Strengthened pointer manipulation skills in linked lists ✓ Learned efficient in-place modification without extra space Learning one problem every single day 🚀 #Java #LeetCode #DSA #LinkedList #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 68 of #100DaysOfCode 🚀 Today I implemented Pascal’s Triangle using Java. At first glance, it looks like just a pattern problem. But internally, it teaches something powerful — building current state from previous state. 🔹 The first and last elements of every row are always 1 🔹 Every middle element = sum of two elements from the previous row 🔹 This is a classic example of bottom-up thinking Instead of hardcoding values, we dynamically generate each row based on the previous one. This problem strengthened: Nested loop understanding 2D List handling in Java Pattern recognition Thinking in terms of recurrence Small problems. Strong foundations. Consistent progress. On to the next one 💪 #100DaysOfCode #Java #DSA #ProblemSolving #LearningInPublic #dsawithkunal
To view or add a comment, sign in
-
-
Day 21 of #100DaysOfLeetCode 💻✅ Solved #27. Remove Element problem on LeetCode in Java. Approach: • Used a two-pointer technique to modify the array in-place • Maintained a pointer k to place elements not equal to val • Iterated through the array and skipped elements equal to val • Placed non-val elements at the k-th position and incremented k • Returned k as the number of remaining elements Performance: ✓ Runtime: 0 ms (Beats 100% submissions) ✓ Memory: 44 MB (Beats ~75% submissions) Key Learning: ✓ Strengthened understanding of in-place array manipulation ✓ Learned how to skip unwanted elements efficiently ✓ Improved confidence in two-pointer techniques for array problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
✅ DSA Day 6 / 100 Solved Maximum Product of Two Elements in an Array on LeetCode using Java. Logic - -We need the two largest numbers in the array -Traverse the array once -Keep track of the largest (max1) and second largest (max2) values - Update them whenever a bigger number is found -Final answer = (max1 - 1) * (max2 - 1) This approach avoids sorting and works efficiently in a single pass. Learning how tracking values smartly can reduce time complexity 🚀 #DSA #100DaysOfCode #Java #LeetCode #Arrays #Consistency
To view or add a comment, sign in
-
-
🚀 Day 6 of My 90 Days Java Full Stack Challenge Today, I focused on understanding the theory of String in Java and solved a few basic String problems to build a strong foundation. 📘 What I learned today: What is String in Java Why String is immutable String Constant Pool (SCP) == vs equals() Difference between String, StringBuilder, and StringBuffer How String works internally (memory & performance basics) 🧩 Practice (Basic Level): ✔ Reverse a String ✔ Check Palindrome ✔ Count vowels & consonants ✔ Remove whitespaces 💡 Key takeaway: Before jumping into advanced DSA problems, clarity of concepts matters more than speed. 📅 Plan for tomorrow: 👉 Solve more String DSA problems (intermediate level) and go deeper with hands-on practice. Learning step by step, one day at a time 💪 #Java #StringInJava #90DaysJavaFullStack #DSA #LearningInPublic #Consistency #DeveloperJourney
To view or add a comment, sign in
-
Today I practiced Selection Sort in Java +Dsa 🔍 I learned that in Selection Sort, when finding the minimum element in the unsorted part of the array, the comparison needs to be done between arr[j] and arr[minIndex], not arr[i]. This small detail makes a big difference in correctness. ✅ Practiced: • Correct Selection Sort implementation • Debugging logic • Dry-run of inner vs outer loop mistakes Final Sorted Output: 👉 {1, 3, 5, 6} #DSA #Java #Programming #CodeDebugging .
To view or add a comment, sign in
-
-
🚀 DSA Series – Episode 6 📌 Linear Queue in Java (Using Array) Today we implemented a Linear Queue in Java using a normal array. ✔️ enqueue() → insert at rear ✔️ dequeue() → delete from front ✔️ Handled overflow & underflow No built-in classes — just core logic 💻 Understanding implementation makes DSA stronger. Next: Circular Queue 🔄 #DSA #Java #Queue #CodingJourney
To view or add a comment, sign in
-
Day 17 – Largest Number At Least Twice of Others Solved this array-based problem by identifying the largest element and verifying whether it is at least twice every other number. Key Learnings: Efficiently finding the maximum element and its index Applying conditional checks carefully Strengthening array traversal fundamentals #Java #LeetCode #DSA #ProblemSolving #CodingJourney
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