#Day357 of #1001DaysOfCode LeetCode Daily Challenge Problem: Decode the Slanted Ciphertext (LeetCode 2075) 💡 Approach: The encoded string represents a matrix filled row-wise. I traversed the matrix diagonally (top-left to bottom-right) by converting 2D indices into a 1D string index. Finally, removed trailing spaces to get the correct decoded message. (*you can use inbuilt .stripTrailing() function as well) ⏱ Time Complexity: O(n) 🧠 Space Complexity: O(n) Staying consistent with daily problem solving 🚀 #DSA #Java #LeetCode #ProblemSolving #Coding
Decode Slanted Ciphertext with Java
More Relevant Posts
-
#Day360 of #1001DaysOfCode 📘 LeetCode Daily Challenge Problem: Search in a Binary Search Tree (LeetCode 700) 💡 Approach: Used the properties of a Binary Search Tree to efficiently search for a value. At each step: If the value is smaller, move to the left subtree If larger, move to the right subtree This reduces the search space at every step. ⏱ Time Complexity: O(h) 🧠 Space Complexity: O(h) Continuing daily consistency in problem solving 🚀 #DSA #Java #LeetCode #BinaryTree #ProblemSolving #Coding
To view or add a comment, sign in
-
-
#Day373 of #1001DaysOfCode LeetCode Daily Challenge Problem: Words Within Two Edits of Dictionary (LeetCode 2452) Approach: For each query word, compared it with every word in the dictionary and counted character mismatches. If the difference was at most 2 characters, the word was added to the result. Used early stopping to optimize comparisons. ⏱ Time Complexity: O(Q × D × L) 🧠 Space Complexity: O(1) Improving efficiency with small optimizations #DSA #Java #LeetCode #ProblemSolving #Coding #Consistency
To view or add a comment, sign in
-
-
🚀 Day 33 of #128DaysOfCode 🧩 Problem Insight: The goal was to check whether a given string can be formed by repeating one of its substrings multiple times. 💡 Key Learning: Instead of checking all possible substrings (which can be inefficient), I learned an elegant trick: By concatenating the string with itself and removing the first and last characters, we can determine if the original string exists within it. ⚡ This approach helped me: - Improve my understanding of string patterns - Learn a smart optimization technique - Avoid brute-force solutions 🛠️ Concepts Practiced: - String manipulation - Pattern recognition - Optimized problem-solving approach 📈 Every day I’m getting better at identifying patterns and writing cleaner, more efficient code. #Day33 #128DaysOfCode #Java #DSA #CodingJourney #ProblemSolving #LeetCode
To view or add a comment, sign in
-
-
There was a time when even starting a problem felt confusing. Reading the question multiple times, not knowing where to begin, and getting stuck often. With consistent practice, things started to change — patterns became familiar, approaches became clearer, and solving started to feel more structured. That consistency has now led to solving 150 problems on LeetCode. Focused on building a strong foundation through arrays, strings, hashing, sliding window, and binary search — spending more time understanding the logic rather than just aiming for accepted submissions. This journey improved: * Problem breakdown and thinking approach * Pattern recognition across questions * Code clarity and structure Currently working on improving speed and taking on more challenging problems. 🔗 LeetCode Profile: https://lnkd.in/gkf7m6wp #LeetCode #DSA #Java #ProblemSolving #Coding #SoftwareEngineering
To view or add a comment, sign in
-
-
Solved Today’s LeetCode Daily Challenge! Problem: Check if Strings Can Be Made Equal With Operations II At first glance, it looks like a swapping problem… but the real trick is understanding the constraint You can only swap characters if the distance between indices is even. Key Insight: Characters at even indices can only swap among even positions Characters at odd indices can only swap among odd positions So instead of simulating swaps (which is messy ), I used a smarter approach: Count frequency of characters at even indices Count frequency at odd indices Compare both strings If both match → Possible Else → Not possible Time Complexity: O(n) Space Complexity: O(1) Takeaway: Sometimes problems look complex, but a small observation can simplify everything. Consistency + pattern recognition = #LeetCode #DSA #Java #Coding #ProblemSolving #TechJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 8 of #100DaysOfCode Solved: Maximum Product of Two Elements in an Array 💻 Today’s problem was all about optimizing logic and thinking smart instead of brute force. Instead of checking every pair, I focused on finding the two largest elements efficiently and used them to compute the result in a single pass 🔥 ✅ Time Complexity: O(n) ✅ Space Complexity: O(1) Small problems like these really sharpen problem-solving skills and reinforce the importance of clean, efficient code. Consistency is key — showing up every day, learning something new, and getting 1% better 💯 #DSA #Java #CodingJourney #LeetCode #ProblemSolving #Consistency #Day8#DSAwithEdSlash
To view or add a comment, sign in
-
-
Day 101 - LeetCode Journey Solved LeetCode 856: Score of Parentheses ✅ Looks tricky at first, but turns out to be a neat pattern problem. Instead of using a stack, used depth tracking + bit manipulation to calculate score efficiently. Core idea: Every "()" contributes 2^depth So just track depth and add score at the right moment. Key learnings: • Understanding pattern inside parentheses • Using depth instead of extra space • Bit manipulation for optimization ⚡ • Clean O(n) solution without stack ✅ All test cases passed ⚡ O(n) time | O(1) space Simple logic, powerful result 💡 #LeetCode #DSA #Stack #BitManipulation #Java #CodingJourney #ProblemSolving #InterviewPrep
To view or add a comment, sign in
-
-
🚀 Day 18 of #100DaysOfCode Solved LeetCode 334 – Increasing Triplet Subsequence 📈 Today’s problem was all about optimizing from brute force to a smart greedy approach. Instead of checking all triplets, I tracked the smallest and second smallest values while iterating once through the array. 💡 Key Insight: If we find a number greater than both first and second, an increasing triplet exists! 🔍 What I learned: Greedy approach can reduce time complexity drastically Maintaining two variables is enough to detect a triplet Writing clean and efficient O(n) solutions ⚡ Performance: Runtime: 2 ms (Beats 99.28%) Memory: Solid optimization #DSAwithEdSlash #LeetCode #Java #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
#Day370 of #1001DaysOfCode 📘 LeetCode Daily Challenge Problem: Mirror Distance 💡 Approach: Reversed the number using recursion by extracting digits and rebuilding the number. Then calculated the absolute difference between the original number and its reversed form. ⏱ Time Complexity: O(d) 🧠 Space Complexity: O(d) Exploring recursion patterns and improving problem-solving skills 🚀 #DSA #Java #LeetCode #Recursion #ProblemSolving #Coding
To view or add a comment, sign in
-
-
🚀 Day 570 of #750DaysOfCode 🚀 🔍 Problem Solved: Words Within Two Edits of Dictionary Today’s problem was a nice mix of strings + observation. At first glance, it feels like a transformation problem, but it simplifies beautifully. 💡 Key Insight: We don’t actually need to perform edits. We just need to check how many characters are different between two words. 👉 If the difference (Hamming distance) ≤ 2 → it's valid 🧠 Approach: For each word in queries, compare it with every word in dictionary Count character differences If any comparison has ≤ 2 differences → include the word in result ⚡ Early break helps optimize the solution! 📈 Complexity: Time: O(Q × D × n) Space: O(1) ✨ Takeaway: Not every problem needs simulation — sometimes reducing it to a simple comparison metric (like character differences) makes it much easier. Consistency > Complexity 💪 #LeetCode #DSA #Java #CodingJourney #ProblemSolving #Tech #LearningEveryday #Strings
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