✅ 𝘿𝙖𝙮 6 𝙋𝙧𝙤𝙜𝙧𝙚𝙨𝙨: 🔹Solved the 𝗠𝗮𝗷𝗼𝗿𝗶𝘁𝘆 𝗘𝗹𝗲𝗺𝗲𝗻𝘁 problem using the 𝗕𝗼𝘆𝗲𝗿-𝗠𝗼𝗼𝗿𝗲 𝗩𝗼𝘁𝗶𝗻𝗴 𝗔𝗹𝗴𝗼𝗿𝗶𝘁𝗵𝗺. 🔹Strengthened understanding of 𝗰𝗮𝗻𝗱𝗶𝗱𝗮𝘁𝗲 𝘀𝗲𝗹𝗲𝗰𝘁𝗶𝗼𝗻 and how majority elements survive pairwise cancellation. 🔹Practiced using a 𝘀𝗶𝗻𝗴𝗹𝗲 𝘁𝗿𝗮𝘃𝗲𝗿𝘀𝗮𝗹 to solve the problem in optimal time complexity. 🔹Improved understanding of maintaining a 𝗰𝗼𝘂𝗻𝘁𝗲𝗿 and resetting the candidate when count becomes zero. 🔹Focused on solving array problems with 𝗢(𝗻) 𝘁𝗶𝗺𝗲 and 𝗢(𝟭) 𝘀𝗽𝗮𝗰𝗲 complexity. 🔹Learned how smart observation can replace brute force nested loop approaches. #DSA #100DaysOfCode #LeetCode #CodingJourney #ProblemSolving #Java #Learning
Solved Majorly Element Problem with Boyer-Moore Voting Algorithm
More Relevant Posts
-
🚀 Day 65/100 Today’s problem was about cyclic string transformation (index shifting). 🔹 Problem: Encrypt a string by replacing each character with the k-th character ahead in a circular manner. 🔹 Key Learning: - Understood how to use modulo (%) for cyclic traversal - Learned that shifting indices is often easier than modifying characters - Optimized solution using "(i + k) % n" 🔹 Approach: - Loop through the string - For each index, pick the character at "(i + k) % n" - Build the result string 🔹 Time Complexity: O(n) 💡 Small concept, but powerful pattern for many problems involving circular arrays/strings. Consistency > Motivation 💯 #Day65 #100DaysOfCode #Java #DSA #CodingJourney #KeepLearning
To view or add a comment, sign in
-
-
Day 37 of showing up consistently 💻🔥 Solved Arithmetic Subarrays — a problem that really sharpened my understanding of subarrays and sequence patterns. 💡 Insight: Instead of checking order directly, sorting the subarray and verifying a constant difference makes the solution clean and efficient. ⚡ Runtime: 4 ms (100% 💯) 📊 Small optimizations → Big impact Every day = 1 step closer to mastery. #Day37 #LeetCode #DSA #Java #CodingJourney #Consistency #KeepGrinding
To view or add a comment, sign in
-
-
🔥 Day 142/360 – Learning Something New Today 🚀 Most people miss this simple trick… But once you understand it, problems become much easier 👇 📌 Topic: Bit Manipulation 🧩 Problem: Single Number II 📝 Problem Statement: Find the element that appears once when all others appear three times 🔍 Example: Input: [2, 2, 3, 2] Output: 3 💡 Approach: Bit Manipulation (Bit Counting) ✔ Step 1 – Traverse all 32 bit positions ✔ Step 2 – Count how many numbers have that bit set ✔ Step 3 – If count % 3 == 1, set that bit in answer ⚡ Key Idea: Duplicate numbers contribute bits in multiples of 3, so taking modulo 3 isolates the unique number ⏱ Complexity: Time → O(n) Space → O(1) 📚 What I Learned: Bit-level thinking can simplify problems that look complex with normal counting 💬 Question for You: Can you solve this problem using XOR without counting bits? 🤔 #DSA #Java #Coding #ProblemSolving #InterviewPrep #LeetCode #TechJourney #142DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 46 of #DSA ✅ Solved: Search a 2D Matrix (LeetCode 74) Today’s problem was about applying Binary Search in a 2D matrix. 💡 Key Insight: Instead of searching row by row, we can treat the matrix as a flattened sorted array and apply binary search directly. ⚙️ Approach: - Consider matrix as 1D - Use index mapping → row = mid / cols, col = mid % cols - Apply standard binary search ⚡ Time Complexity: O(log (m × n)) 📚 Key Learning: Sometimes changing the perspective (2D → 1D) makes problems much simpler and more efficient. Leveling up with Binary Search 🔥 #Day46 #BinarySearch #LeetCode #Java #DSA #CodingJourney #ProblemSolving #100DaysOfCode #Tech
To view or add a comment, sign in
-
-
Day 92 of #100DaysOfLeetCode 💻✅ Solved #739. Daily Temperatures problem in Java. Approach: • Used Monotonic Stack to track indices • Compared current temperature with stack top • Updated result when a warmer day was found • Stored indices for future comparisons Performance: ✓ Runtime: 60 ms (Beats 79.01% submissions) 🚀 ✓ Memory: 107.89 MB (Beats 17.53% submissions) Key Learning: ✓ Learned Monotonic Stack technique ✓ Improved handling of next greater element problems ✓ Strengthened stack-based problem solving Learning one problem every single day 🚀 #Java #LeetCode #DSA #Stack #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
📘 DSA Journey — Day 33 Today’s focus: Binary Search for next greater element. Problem solved: • Find Smallest Letter Greater Than Target (LeetCode 744) Concepts used: • Binary Search • Upper bound concept • Circular handling Key takeaway: The goal is to find the smallest character strictly greater than a given target in a sorted array. This is a classic upper bound problem: We use binary search to find the first element greater than the target. During search: • If letters[mid] > target, store it as a possible answer and move left • Else move right An important edge case: If no character is greater than the target, we return the first element (circular behavior). Continuing to strengthen binary search patterns and problem-solving consistency. #DSA #Java #LeetCode #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 15 of #DSAwithEdSlash Solved: Bulb Switcher 💡 Today’s problem looked simple at first but had a really interesting mathematical insight behind it. Instead of simulating all the toggles, the key realization is that only perfect squares remain ON after all rounds. 💡 Key Takeaways: Importance of pattern recognition 🔍 Optimization using mathematical logic instead of brute force Counting perfect squares ≤ n gives the answer 📊 Result: ⚡ Optimized Time Complexity: O(√n) 💻 Efficient Java implementation Consistency is building confidence day by day 💪 #Day15 #DSA #LeetCode #Java #ProblemSolving #CodingJourney #Consistency #PlacementPrep
To view or add a comment, sign in
-
-
----------LeetCode Progress Update Solved: Positions of Large Groups (830) * Problem Insight: Identify groups of consecutive identical characters and return intervals where the group size ≥ 3. * Approach: • Used two pointers (i, j) to scan continuous character groups • Expanded j while characters matched • Checked group length (j - i >= 3) • Stored valid intervals and moved to next group * Key Learning: Two-pointer technique is powerful for handling contiguous segments efficiently in strings. #LeetCode #DSA #Java #TwoPointers #ProblemSolving
To view or add a comment, sign in
-
-
Solved: Shortest Distance to Target String in a Circular Array(#2515) 🔹 Problem Insight: This problem is based on circular array traversal where we calculate both: • Straight Distance • Circular Distance 🔹 Approach: 1.Traverse the array 2.Check for target using equals() 3.Calculate: 👉 Straight Distance = |i - startIndex| 👉 Circular Distance = n - Straight Distance(where n = length of Array) 4.Take minimum of both 🔹 Key Learning: Understanding circular logic and optimizing distance calculation #LeetCode #Java #DSA #CodingChallenge #SoftwareDeveloper
To view or add a comment, sign in
-
-
Day 69 of #100DaysOfLeetCode 💻✅ Solved #349. Intersection of Two Arrays problem in Java. Approach: • Iterated through each element of the first array • Checked if the element exists in the second array • Used a temporary array to store intersection elements • Ensured no duplicates by checking already added elements • Copied the result into a final array of correct size Performance: ✓ Runtime: 4 ms (Beats 35.60%) ✓ Memory: 44.41 MB (Beats 96.71%) Key Learning: ✓ Practiced array traversal using nested loops ✓ Learned how to handle duplicates manually ✓ Improved understanding of set-like operations without using extra data structures Learning one problem every single day 🚀 #Java #LeetCode #DSA #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
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