🚀 Daily DSA Practice – Day 9 | Strings & Hashing (Java) Continuing my structured DSA preparation, today I focused on string problems involving character frequency and hashing, implemented using Java. 📌 Problems Solved (LeetCode): • 242. Valid Anagram – Character frequency comparison using arrays / HashMap • 387. First Unique Character in a String – Frequency tracking with single pass optimization • 383. Ransom Note – Efficient character availability validations. 🎯 Key Learnings: ✔ Practical use of HashMap and frequency arrays ✔ Writing O(n) time complexity solutions ✔ Understanding trade-offs between space vs performance ✔ Improved clarity in handling character-based constraints Consistent practice is reinforcing my ability to translate problem statements into optimized, readable Java code, aligned with industry-level expectations. #DSA #LeetCode #Java #Hashing #ProblemSolving #SoftwareEngineer #BackendDeveloper #InterviewPreparation
Java DSA Practice Day 9: Strings & Hashing
More Relevant Posts
-
🚀Day 5 of #120DaysOfCode 📌 Problem: Height Checker 📌 Language: Java 🔍Approach(Two Pointer Technique) 1. make a copy of heights 2. Sort the copy --> this becomes expected 3. Traverse both arrays 4. Count indices where values differ 🔥 Key Insight 1. Create the expected order by sorting a copy of heights 2. Compare both arrays index by index 3. Count mismatches ⏱️ Time and Space Complexity Time Complexity: O(n log n) Space complexity: O(n) 🔥One problem closer to mastery #120DaysOfCode #Day5 #Java #Array #Leetcode #ProblemSolving #Consistency #LearningEveryday #LearningPublic #DSA
To view or add a comment, sign in
-
-
🚀Day 14 of #120DaysOfCode 📌 Problem: Matrix Reshape(566) 📌 Language: Java 🔍Approach 1. Check if Reshape is possible 2. Traverse the original matrix in row order 3. Mapping logic ⏱️ Time and Space Complexity Time Complexity: O(m x n) Space complexity: O(r x c) 🔥One problem closer to mastery #120DaysOfCode #Day14 #Java #Array #Leetcode #ProblemSolving #Consistency #LearningEveryday #LearningPublic #DSA
To view or add a comment, sign in
-
-
Day 3 of #120DaysOfCode🚀 📌Problem: Replace Elements with Greatest Element on Right Side 📌Language: Java 🔍Approach 1. Maintain a variable maxRight 2. Initially set it to -1 (for last element) 3. Traverse from the end 4. For each element . Save current value . Replace it with maxRight . Update maxRight ⏱️Time & Space Complexity Time Complexity: O(n) Space complexity: O(1) #120DaysOfCode #Day3 #Java #Arrays #DSA #ProblemSolving #Consistenncy #LearningEverday #LearninhPublic #Leetcode
To view or add a comment, sign in
-
-
🚀Day 6 of #120DaysOfCode 📌 Problem: Third Maximum number(414) 📌 Language: Java 🔍Approach . Duplicates must be ignored . Sorting is easy but not optimal . We only need top 3 distinct values 🔥 Approaches Maintain three variable . max1 --> largest . max2 --> second largest . max3 --> third largest ⏱️ Time and Space Complexity Time Complexity: O(n) Space complexity: O(1) 🔥One problem closer to mastery #120DaysOfCode #Day6 #Java #Array #Leetcode #ProblemSolving #Consistency #LearningEveryday #LearningPublic #DSA
To view or add a comment, sign in
-
-
🚀Day 9 of #120DaysOfCode 📌 Problem: Largest Number At Least Twice of Others(747) 📌 Language: Java 🔍Approach 1. Traverse the array once to find the largest (max1) and second largest (max2) elements. 2. While updating the largest element, also store it's index. 3. After traversal, check if max >= 2 * max2 4. If true, return the stored index; otherwise, return -1. ⏱️ Time and Space Complexity Time Complexity: O(n) Space complexity: O(1) 🔥One problem closer to mastery #120DaysOfCode #Day9 #Java #Array #Leetcode #ProblemSolving #Consistency #LearningEveryday #LearningPublic #DSA
To view or add a comment, sign in
-
-
27/100 🚀 LeetCode Progress ✅ LeetCode 24: Swap Nodes in Pairs Solved this problem using a divide-and-merge approach on a linked list. 🔹 Approach: Divide the linked list into pairs of nodes Swap each pair individually Merge the swapped pairs back into a single linked list This approach helps in understanding linked list manipulation, pointer handling, and improves confidence in solving real interview-style problems. 📌 Consistency is the key — moving steadily toward my goal of solving 100+ LeetCode problems to strengthen my DSA skills in Java. 🔗 Solution Link: https://lnkd.in/gc9A3yWk #LeetCode #DSA #LinkedList #Java #ProblemSolving #CodingJourney #100DaysOfCode #SoftwareDeveloper
To view or add a comment, sign in
-
-
🚀 Day 66 of #100DaysOfCode | Top K Frequent Elements Solved Top K Frequent Elements using an efficient Bucket Sort–based approach in Java. Approach used: Count the frequency of each element using a HashMap Create a bucket array where the index represents frequency Traverse the buckets from highest to lowest frequency to collect the top k elements Why this approach is efficient: No need to sort the entire array Makes use of the frequency range (1 → n) Works well even for large inputs Time & Space Complexity: Time: O(n) Space: O(n) Key takeaways: Bucket Sort is extremely useful for frequency-based problems Understanding constraints leads to optimal solutions Clean logic beats overcomplicated code Consistency is the real win. On to Day 68 💪 #Day67 #DSA #Java #LeetCode #ProblemSolving #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🚀Day 7 of #120DaysOfCode 📌 Problem: Find all numbers disappeared in an Array(448) 📌 Language: Java 🔍Approach: Using HashSet . Store all elements of nums in a set . Loop from 1 to n . If a number is not in the set --> it's missing ⏱️ Time and Space Complexity Time Complexity: O(n) Space complexity: O(n) 🔥One problem closer to mastery #120DaysOfCode #Day6 #Java #Array #Leetcode #ProblemSolving #Consistency #LearningEveryday #LearningPublic #DSA
To view or add a comment, sign in
-
-
Day 5/30 – LeetCode #283 (Move Zeroes) | Java The naive approach involved shifting elements multiple times, which makes the logic messy and inefficient. The challenge was finding a way to move all zeroes without disturbing the order of non-zero elements. Using a two-pointer approach, I tracked the position for the next non-zero element and rebuilt the array in-place. This achieved O(n) time complexity with O(1) extra space while preserving the original order. This problem highlighted how pointer-based logic in Java can simplify array manipulation and improve performance. #LeetCode #Java #DSA #TwoPointers #Arrays #Consistency #LearningInPublic
To view or add a comment, sign in
-
-
📅 Winter Arc | Task 1/30 🎯 Challenge: Understanding Java Architecture & Workflow Today’s focus: Day 1 — Java Overview + First Programs ✅ What I worked on today: I wrote my first Java program to print output on the screen. Updated it to use variables (String and int) to display my name and XP. Learned how to take user input using the Scanner class. Connected this with Java’s execution flow: Source Code → Compiler → Bytecode → JVM → Execution. Practiced running programs in an online compiler and understood how the JVM handles them. 📚 Key takeaways from today: Java follows Write Once, Run Anywhere (WORA) because the JVM executes bytecode. JDK = development tools, JRE = environment to run programs, JVM = engine that executes bytecode. Class Loader, Bytecode Verifier, and JIT Compiler are important parts of Java’s runtime system. Writing and running simple programs makes the architecture easier to understand. Building fundamentals first — everything else becomes easier from here ❄️🔥 MATRIX JEC #MatrixWinterArc #BuildWithMatrix #WinterArc #30DayChallenge #DailyProgress #MatrixJEC
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
keep it up bro