🚀 Day 46/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 2315. Count Asterisks Used a boolean flag approach to track whether the current position is inside a pair of '|' and count only the valid '*' outside those sections. ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(1) Strengthening understanding of state-based string traversal and conditional counting. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
LeetCode Java Solution: Count Asterisks
More Relevant Posts
-
🚀 Day 47/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 448. Find All Numbers Disappeared in an Array Used an in-place marking technique by treating indices as a hash map and marking visited numbers as negative to identify missing elements. ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(1) (excluding output list) Strengthening understanding of array manipulation and in-place hashing tricks. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🚀 Day 57/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 242. Valid Anagram Used a HashMap frequency counting approach (Unicode-safe using code points) to compare character frequencies of both strings. ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(n) Strengthening understanding of string frequency analysis and Unicode handling. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🚀 Day 48/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 1534. Count Good Triplets Used a brute-force triple nested loop to check all possible triplets and validate the given conditions using absolute differences. ⏱️ Time Complexity: O(n³) 📦 Space Complexity: O(1) Strengthening understanding of nested loop patterns and condition-based filtering. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🚀 Day 65/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 2535. Difference Between Element Sum and Digit Sum of an Array Used a single loop + digit extraction approach to calculate both element sum and digit sum efficiently. ⏱️ Time Complexity: O(n × d) 📦 Space Complexity: O(1) Strengthening understanding of number manipulation and digit-based operations. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🚀 Day 69/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 2103. Rings and Rods Used a 2D boolean array to track presence of colors (R, G, B) on each rod and counted rods containing all three. ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(1) Strengthening understanding of mapping, indexing, and state tracking techniques. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🚀 Day 23 of #75DaysOfCode Solved: Equal Row and Column Pairs 🔹 Problem: Given an n x n matrix, count the number of pairs (ri, cj) such that row ri and column cj are exactly the same. 🔹 Approach: • Stored all rows in a HashMap with their frequency • Converted each column into a comparable string format • Matched columns with stored rows to count equal pairs 🔹 Key Learning: Using StringBuilder instead of String concatenation significantly improves performance due to immutability of Strings in Java. 🔹 Time Complexity: O(n²) 🔹 Takeaway: Smart use of HashMap + efficient string handling can simplify and optimize matrix-based problems. #Day22 #75DaysOfCode #Java #DSA #LeetCode #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 58/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 278. First Bad Version Used binary search on answer space to efficiently find the first bad version while minimizing API calls. ⏱️ Time Complexity: O(log n) 📦 Space Complexity: O(1) Strengthening understanding of binary search optimization and decision-based problems. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
Solved a problem where we need to check if two strings can be made equal using a special operation. The rule is: you can swap characters only if the distance between their positions is even. So basically, characters at even indices can only swap among themselves, and same for odd indices. Idea: Instead of actually swapping, I just counted characters separately for even and odd positions in both strings. If both match, then it’s possible — otherwise not. Simple concept, but interesting twist! 😊 #LeetCode #DSA #Java #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
Day 88 - LeetCode Journey Solved LeetCode 24: Swap Nodes in Pairs in Java ✅ This problem is a great exercise in pointer manipulation in linked lists. Instead of changing values, I swapped the actual nodes by carefully adjusting the next pointers. Using a dummy node made the process much cleaner and helped handle edge cases smoothly. Step by step, I swapped pairs while moving forward in the list. Key takeaways: • Deep understanding of pointer manipulation • Importance of dummy node in linked list problems • Clean handling of edge cases • Iterative approach for swapping nodes ✅ All test cases passed ⚡ Efficient O(n) time and O(1) space Linked list problems like this really sharpen your fundamentals 🔥 #LeetCode #DSA #Java #LinkedList #Pointers #ProblemSolving #CodingJourney #InterviewPrep #Consistency #100DaysOfCode
To view or add a comment, sign in
-
-
Day 62 of #100DaysOfLeetCode 💻✅ Solved #219. Contains Duplicate II problem in Java. Approach: • Used two nested loops to compare elements within range k • For each element, checked next k elements • If any duplicate is found within distance k, returned true • If no such pair exists, returned false Key Learning: ✓ Practiced checking duplicates within a given range ✓ Strengthened understanding of array traversal with conditions ✓ Learned the importance of optimizing nested loop solutions Learning one problem every single day 🚀 #Java #LeetCode #DSA #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
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