60-Day LeetCode Challenge – Day 40 Solved Check if All Characters Have Equal Number of Occurrences on LeetCode. 📌 Approach: Used a frequency array (size 26) to count occurrences of each character, then compared all non-zero frequencies with an expected value. 🧠 Learning: Reinforced frequency counting patterns — a super common technique in string problems. ⚡ Complexity: • Time Complexity: O(n) • Space Complexity: O(1) Starting to see patterns repeat across problems — that’s when things begin to click ⚡ #LeetCode #DSA #Java #Strings #Consistency #ProblemSolving
Check if All Characters Have Equal Occurrences on LeetCode
More Relevant Posts
-
🚀 Day 11/100 — #100DaysOfLeetCode Consistency continues — one problem closer to better problem-solving skills 💻🔥 ✅ Problem Solved: 🔹 LeetCode 1423 — Maximum Points You Can Obtain from Cards 💡 Concepts Used: Sliding Window Technique Complementary Subarray Thinking 🧠 Key Learning: Instead of directly choosing k cards from both ends, I learned to think differently — find the minimum sum subarray of size n - k and subtract it from the total sum. This transformation converts a complex decision problem into a clean sliding window optimization. ⚡ Takeaway: Sometimes optimization comes from changing perspective, not increasing complexity. Continuing the journey 🚀 #100DaysOfLeetCode #LeetCode #DSA #SlidingWindow #Algorithms #Java #ProblemSolving #CodingJourney #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Day 14 of LeetCode Problem Solving Solved today’s problem — LeetCode #34: Find First and Last Position of Element in Sorted Array 💻🔥 ✅ Approach: Binary Search (Twice) ⚡ Time Complexity: O(log n) 📊 Space Complexity: O(1) The task was to find the starting and ending position of a target element in a sorted array. 👉 Instead of linear search, I used Binary Search twice: One to find the first occurrence One to find the last occurrence 💡 Key Idea: Modify binary search slightly to keep searching even after finding the target. 👉 Core Logic: If target found → store index Continue searching left (for first position) Continue searching right (for last position) 💡 Key Learning: Binary Search is not just for finding elements — it can be modified to solve many variations efficiently. Consistency is the key — getting better every day 🚀 #Day14 #LeetCode #DSA #Java #CodingJourney #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 16 of LeetCode Problem Solving Solved today’s problem — LeetCode #26: Remove Duplicates from Sorted Array 💻🔥 ✅ Approach: Two Pointers ⚡ Time Complexity: O(n) 📊 Space Complexity: O(1) The task was to remove duplicates in-place from a sorted array and return the count of unique elements. 👉 I used the Two Pointer technique: One pointer to track unique elements Another to traverse the array 💡 Key Idea: Since the array is sorted, duplicates will be adjacent — making it easier to skip them. 👉 Core Logic: Compare nums[i] with nums[j] If different → move pointer and update value Maintain unique elements at the beginning 💡 Key Learning: Two Pointer is a very powerful technique for array problems — especially when data is sorted. Consistency is the key — getting better every day 🚀 #Day16 #LeetCode #DSA #Java #CodingJourney #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Day 22/100 — LeetCode Today’s problem: Happy Number 😊 At first, it looked like a simple math problem… but it turned out to be about patterns and repetition. 🔍 What I learned: Break a number into digits using % 10 and / 10 Square each digit and keep adding Repeat the process until: You reach 1 → Happy Number ✅ Or it starts repeating → Not Happy ❌ 🧠 Key Insight: This problem is actually about cycle detection — if a number repeats, it will never reach 1. ⚡ Simple Example: 19 → 82 → 68 → 100 → 1 ✅ 💡 Takeaway: Sometimes problems that look like math are really about loops and patterns. Small steps every day → Big improvement 🚀 #Day22 #100DaysOfCode #LeetCode #Java #DSA #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 126/500 – LeetCode DSA Challenge Today I solved problems focused on strings and frequency counting. ✅ Ransom Note – Used frequency array to check if the note can be constructed from magazine characters. TC: O(n + m) | SC: O(1) ✅ Find Common Characters – Iteratively found common characters across all strings using string manipulation. TC: O(n × k) | SC: O(k) 💡 Key Learning: Frequency counting is a powerful technique for string problems, and careful string manipulation helps in handling character intersections. 👉 Day 126/500 #DSA #Java #500DaysChallenge #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
LeetCode Challenge – Day 49 Today I solved the Linked List Cycle problem. Problem Insight: Given a linked list, determine whether it contains a cycle (loop). A cycle occurs when a node points back to a previous node instead of reaching null. Approach: Used Floyd’s Cycle Detection Algorithm (Tortoise and Hare) Maintained two pointers: Slow pointer moves one step at a time Fast pointer moves two steps at a time If a cycle exists, both pointers will eventually meet If not, the fast pointer will reach the end of the list Key Learning: Using two pointers with different speeds helps efficiently detect cycles without extra space. Complexity: Time: O(n) Space: O(1) Understanding pointer movement made this problem much easier to solve. #LeetCode #Java #DSA #CodingJourney
To view or add a comment, sign in
-
🚀 Day 25 of Consistency – LeetCode Journey Today I solved Problem 268: Missing Number on LeetCode. 💡 Approach I Used (Optimal – Math Based): First, I calculated the expected sum of numbers from 0 to n using the formula: 👉 n * (n + 1) / 2 Then: ✅ Calculated the actual sum of all elements in the array ✅ Subtracted actual sum from expected sum 🎯 The result gives the missing number 🧠 Key Learning: This problem shows how a simple mathematical formula can optimize performance and reduce complexity. ⚡ Complexity: • Time: O(n) • Space: O(1) 📌 Consistency is building my problem-solving mindset step by step. #Day25 #LeetCode #DSA #Java #CodingJourney #Consistency #ProblemSolving
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
-
-
#100DaysOfCode – Day 10 📌 Today’s Problem: LeetCode 152 – Maximum Product Subarray This one was tricky and super interesting! Unlike sum problems, product problems behave differently because of negative numbers and zeros. Key Learning: A negative number can flip the result So we track both: maxSoFar → maximum product till current index minSoFar → minimum product (important for negative flip) Core Idea: If current number is negative → swap maxSoFar and minSoFar Update both values at each step Keep track of global maximum Complexity: Time: O(n) Space: O(1) Takeaway: Tracking both max & min is the key to handling negative numbers in product-based problems. #LeetCode #Java #DSA #CodingJourney #Day10
To view or add a comment, sign in
-
-
60-Day LeetCode Challenge – Day 43 Solved Check If Two String Arrays are Equivalent on LeetCode. 📌 Approach: Concatenated both string arrays into two strings and compared them using .equals(). 🧠 Learning: Reinforced how string building and comparison works, especially when data is split across arrays. ⚡ Complexity: • Time Complexity: O(n + m) • Space Complexity: O(n + m) Simple logic, but a clean reminder that breaking a problem down makes it easier to solve. #LeetCode #DSA #Java #Strings #Consistency #ProblemSolving #LeetCode60
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