🚀 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
Solved LeetCode 2103 Rings and Rods in Java
More Relevant Posts
-
🚀 Day 52/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 3174. Clear Digits Used a stack-like approach with StringBuilder to remove the closest non-digit character whenever a digit is encountered. ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(n) Strengthening understanding of string processing and stack-based logic simulation. 💪 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 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
To view or add a comment, sign in
-
-
🚀 Day 54/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 1656. Design an Ordered Stream Used an array + pointer approach to store values by index and return consecutive chunks by moving a pointer forward whenever elements are available. ⏱️ Time Complexity: O(n) (amortized across all insert calls) 📦 Space Complexity: O(n) Strengthening understanding of design problems and pointer-based simulation techniques. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🚀 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 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 48 of My #LeetCode Journey Today’s problem: 2615. Sum of Distances 💡 Key Idea: Instead of calculating distances between equal elements using brute force (O(n²)), I used: HashMap to group indices of same values Prefix Sum to efficiently compute distances This reduced the complexity to O(n) 🔥 🧠 What I Learned: How prefix sums can optimize distance calculations Efficient handling of repeated elements Writing clean and optimized code using Java ⚡ Approach: Store indices of each number Use prefix sums to calculate left & right distances Combine both to get final answer 📈 Time Complexity: O(n) 📦 Space Complexity: O(n) Consistency is key. Small progress every day leads to big results 💪 #Day48 #Java #FullStackDeveloper #CodingJourney #100DaysOfCode #DSA #LeetCode
To view or add a comment, sign in
-
LeetCode — Problem 189 | Day 3 💡 Problem: Rotate Array Given an array, rotate it to the right by k steps. 🧠 My Approach: - Used reverse technique for in-place rotation - First reversed the entire array - Then reversed first k elements - Finally reversed remaining elements - Handled k using k = k % n This problem gave a good understanding of: ✔️ Array manipulation ✔️ In-place optimization (O(1) space) ✔️ Reverse logic #LeetCode #DSA #Java #CodingJourney
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
-
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