🚀 Day 2/75 – LeetCode Challenge Today I solved the problem “Greatest Common Divisor of Strings” 💡 In this problem, we are given two strings and need to find the largest string that can divide both of them (i.e., by repeating itself). 🔍 Key Learnings: Pattern recognition is very important The condition (str1 + str2 == str2 + str1) simplifies the problem Mathematical concepts like GCD can be applied to strings 🤯 🧠 Approach: First, check if both strings are compatible Then, find the GCD of their lengths Finally, take the substring of that length as the answer 💻 Language: Java Staying consistent and learning every day 🔥 #LeetCode #CodingJourney #Java #DSA #100DaysOfCode #LearningInPublic
Greatest Common Divisor of Strings LeetCode Challenge
More Relevant Posts
-
Day 73 of #100DaysOfLeetCode 💻✅ Solved #389. Find the Difference problem in Java. Approach: • Initialized a variable to store the sum • Added ASCII values of all characters in string t • Subtracted ASCII values of all characters in string s • The remaining value represents the extra character • Converted the result back to character and returned it Performance: ✓ Runtime: 1 ms (Beats 99.89% submissions) 🚀 ✓ Memory: 42.77 MB (Beats 97.03% submissions) Key Learning: ✓ Practiced optimized string traversal using enhanced for-loop ✓ Reinforced understanding of ASCII-based solutions ✓ Learned how mathematical approaches can simplify problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #Strings #Math #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 84 — LeetCode Practice 🚀 Today’s focus was on number manipulation and reversing digits. ✅ Problem solved today: 🔹 Mirror Distance of an Integer 💡 Key learnings from today: • Understood how to reverse an integer using modulus (%) and division (/) • Learned how to construct a number digit by digit • Practiced using Math.abs() for absolute difference • Strengthened understanding of basic arithmetic operations • Improved ability to implement clean logic in Java Initially, I solved the problem by manually reversing the number step by step. This helped me clearly understand how digits are extracted and rebuilt. Later, I realized that the core idea is simple: Find the reversed number and compute the absolute difference. This problem reinforced an important lesson: Strong fundamentals make even tricky-looking problems easy to solve. Digit by digit, improving every day 💪 On to the next challenge 🚀 #Day84 #DSA #LeetCode #ProblemSolving #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
Day 60 of #100DaysOfLeetCode 💻✅ Solved #389. Find the Difference problem in Java. Approach: • Initialized a variable to store the sum • Subtracted ASCII values of all characters in string s • Added ASCII values of all characters in string t • The remaining value represents the extra character • Converted the result back to character and returned it Performance: ✓ Runtime: 3 ms (Beats 38.82% submissions) ✓ Memory: 43.34 MB (Beats 30.69% submissions) Key Learning: ✓ Learned a clever use of ASCII values for problem solving ✓ Practiced using math-based approach instead of extra data structures ✓ Improved understanding of string manipulation techniques Learning one problem every single day 🚀 #Java #LeetCode #DSA #Strings #Math #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 72 — LeetCode Practice 🚀 Today’s problem: Sorting the Sentence 💡 What I learned today: • Practiced string manipulation and splitting techniques • Understood how to extract numbers from characters using ASCII logic • Learned to map words to correct positions using indexing • Improved attention to detail while handling edge cases 🧠 Key idea: Each word has a number at the end → use it to place the word in the correct position → then remove the number and rebuild the sentence. ✨ Consistency is slowly turning confusion into clarity. #Day72 #LeetCode #Java #ProblemSolving #DSA #CodingJourney #Consistency
To view or add a comment, sign in
-
-
LeetCode Challenge – Day 46 Today I solved the Search in Rotated Sorted Array problem. Problem Insight: We are given a sorted array that has been rotated at some unknown index. The task is to find the index of a target element in O(log n) time. Approach: Applied Binary Search At every step, identified which half of the array is sorted Checked whether the target lies in the sorted half Narrowed down the search space accordingly Key Learning: Even if the array is not fully sorted, one half is always sorted. Using this observation, we can still apply binary search efficiently. Complexity: Time: O(log n) Space: O(1) Initially, this problem felt confusing, but breaking it into smaller decisions made it much easier to understand. #LeetCode #Java #DSA #CodingJourney
To view or add a comment, sign in
-
Day 93 - LeetCode Journey Solved LeetCode 9: Palindrome Number in Java ✅ At first glance, it feels like a string problem… but the real challenge is solving it without converting to string. Instead of reversing the whole number, I reversed only half of it and compared both parts. This avoids overflow and keeps it efficient. Smart approach > brute force 💡 Key takeaways: • Handling edge cases (negative numbers, trailing zeroes) • Reversing only half of the number • Avoiding extra space (no string conversion) • Writing optimized mathematical logic ✅ All test cases passed ⚡ O(log n) time and O(1) space Sometimes the best solutions are the simplest ones, just a different way of thinking 🔥 #LeetCode #DSA #Java #Math #ProblemSolving #CodingJourney #InterviewPrep #Consistency #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 25/100 Days of Code Challenge 🔥 Problem: Rotate String(Leetcode 796) We are given two strings s and goal. 👉 We need to check if we can rotate string s (move first character to last again and again) to make it equal to goal. 📌 Example: abcde → bcdea → cdeab → deabc → eabcd ⚙️ Approach Check if lengths of both strings are equal Concatenate string with itself → s + s Check if goal exists inside the new string ⏱️ Complexity Time Complexity: O(n) Space Complexity: O(n) 📚 What I Learned ✔️ Simple tricks can save time ✔️ Avoid unnecessary loops ✔️ Think smart, not hard 💪 Day by day improving 🚀 #100DaysOfCode #Coding #Java #DSA #LearningJourney
To view or add a comment, sign in
-
-
#CodeEveryday — My DSA Journey | Day 3 🧩 Problem Solved: Combination Sum III (LeetCode #216) 💭 What I Learned: Used backtracking to find all possible combinations of k numbers (1–9) that sum up to a target n. At each step: ✔️ Decided whether to include the current number ✔️ Reduced both the remaining sum (n) and count (k) ✔️ Ensured each number is used only once by moving to the previous index Applied constraints effectively to prune recursion when: Remaining sum becomes negative Required count becomes invalid This improved my understanding of handling multiple constraints (sum + size) simultaneously in recursion. ⏱ Time Complexity: O(C(9,k) 🧠 Space Complexity: O(k) (recursion depth) ⚡ Key Takeaways: ✔️ Backtracking with multiple constraints requires careful pruning ✔️ Fixed input size can significantly reduce complexity ✔️ Choosing + skipping pattern helps explore all valid combinations 💻 Language Used: Java ☕ 📘 Concepts: Backtracking · Recursion · Combinations · Constraint Handling #CodeEveryday #DSA #LeetCode #Java #Backtracking #ProblemSolving #Algorithms #CodingJourney #Consistency 🚀
To view or add a comment, sign in
-
-
🚀 Day 58 / 100 – LeetCode Challenge ✅ Problem Solved: Binary Tree Postorder Traversal 📊 Difficulty: Easy 💻 Language: Java Today’s problem focused on understanding tree traversal, specifically Postorder Traversal (Left → Right → Root). 🔍 Key Learnings: Mastered recursive approach for tree traversal Understood how DFS (Depth First Search) works in binary trees Strengthened problem-solving with clean and efficient logic ⚡ Performance: Runtime: 0 ms (Beats 100%) 🔥 Memory: 42.96 MB 💡 Approach: Used a simple recursive helper function: Traverse left subtree Traverse right subtree Add root node value This problem may be easy, but it builds a strong foundation for advanced tree problems 💪 📈 Consistency is key — 58 days down, 42 more to go! #LeetCode #100DaysOfCode #Java #DataStructures #CodingJourney #BinaryTree #DSA #Learning #Consistency
To view or add a comment, sign in
-
-
Day 87 of #100DaysOfLeetCode 💻✅ Solved #334. Increasing Triplet Subsequence problem in Java. Approach: • Used Greedy approach with two variables • Tracked smallest and second smallest values • Updated values while traversing array • Returned true when a valid triplet was found Performance: ✓ Runtime: 2 ms (Beats 99.30% submissions) 🚀 ✓ Memory: 122.40 MB (Beats 80.69% submissions) Key Learning: ✓ Learned efficient Greedy strategy for subsequences ✓ Improved tracking of minimum values dynamically ✓ Strengthened understanding of pattern detection in arrays Learning one problem every single day 🚀 #Java #LeetCode #DSA #Greedy #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