💻 Day 53 of #100DaysOfCode 💻 Today, I solved LeetCode Problem #709 – To Lower Case 🔠 This problem focuses on string manipulation and character encoding (ASCII values) — one of the simplest yet fundamental concepts in text processing. 💡 Key Learnings: Reinforced understanding of ASCII value ranges for uppercase and lowercase alphabets. Practiced efficient string traversal and conditional conversion using StringBuilder in Java. Time complexity: O(n) — iterates through the string once. Space complexity: O(n) — for the output string. 💻 Language: Java ⚡ Runtime: 0 ms — Beats 100% 🚀 📉 Memory: 41.78 MB — Beats 43.48% 🧠 Approach: 1️⃣ Iterate through each character in the string. 2️⃣ Check if it’s an uppercase letter (A–Z). 3️⃣ Convert it to lowercase by adding 32 (based on ASCII values). 4️⃣ Append to the final string using StringBuilder. ✨ Takeaway: Sometimes, understanding the basics like ASCII values can help you write your own efficient methods — without relying on built-in functions! #100DaysOfCode #LeetCode #Java #CodingChallenge #ProblemSolving #Algorithms #StringManipulation #SoftwareEngineering #LearningEveryday #CleanCode
Solved LeetCode Problem #709: To Lower Case in Java
More Relevant Posts
-
🔥 LeetCode Day--- 4 | “Median of Two Sorted Arrays” (Hard, Java) Today’s challenge was one of those that really test your logic, patience, and understanding of binary search. This problem wasn’t about just merging two sorted arrays — it was about thinking smarter 🧠. Instead of brute-forcing through both arrays (O(m+n)), I implemented a binary partition approach to achieve O(log(min(m, n))) efficiency 💡 What I learned today: Always choose the smaller array for binary search — it makes the partition logic simpler. Handle boundaries carefully with Integer.MIN_VALUE and Integer.MAX_VALUE. The goal is to find the perfect partition where: Left half ≤ Right half Elements are balanced across both arrays Once that’s done → median can be easily calculated! ✅ Result: Accepted | Runtime: 0 ms 🚀 Hard problem turned into a logic puzzle that was actually fun to solve! 🧩 Concepts Strengthened: Binary Search Partitioning Logic Edge Case Handling Mathematical Thinking #LeetCode #Day4 #Java #BinarySearch #ProblemSolving #CodingChallenge #DataStructures #Algorithms #CodeEveryday #DeveloperJourney #TechLearning #LeetCodeHard #CodingCommunity
To view or add a comment, sign in
-
-
🚀 Day 35 of 100 Days of LeetCode 📘 Problem: Binary Tree Inorder Traversal 💻 Language: Java ✅ Status: Accepted — Runtime ⚡ 1 ms Today’s focus was on mastering tree traversal, one of the most essential techniques in data structures 🌳 The goal was simple — visit nodes in order (Left → Root → Right), but the recursive logic behind it reinforced clarity and structured thinking. ✨ Key Learnings: Recursive approach simplifies traversal logic 🧠 Base cases are the backbone of recursion Understanding tree patterns helps in mastering complex problems like BSTs and DFS 💬 “A binary tree teaches one thing — structure leads to clarity.” #Day35 #100DaysOfCode #LeetCode #Java #BinaryTree #Recursion #ProblemSolving #DSA #CodingJourney #SoftwareDevelopment #KeepLearning
To view or add a comment, sign in
-
-
💻 Day 4 of #100DaysOfCode Challenge Topic: Binary Tree Traversals 🌳 Problems Solved: 🔹 94. Binary Tree Inorder Traversal 🔹 144. Binary Tree Preorder Traversal 🔹 145. Binary Tree Postorder Traversal Concept Recap: Today, I explored the three fundamental depth-first traversal techniques used in binary trees: ✅ Inorder (Left → Root → Right) – Produces a sorted order for BSTs. ✅ Preorder (Root → Left → Right) – Useful for creating a copy of the tree or serialization. ✅ Postorder (Left → Right → Root) – Ideal for deleting trees or evaluating expressions. Each traversal follows a recursive approach to explore nodes systematically. Implementing them helped me strengthen my understanding of recursion and how stack frames manage function calls behind the scenes. Key Learnings: 🧠 Understood how traversal order impacts output sequence. ⚙️ Practiced recursive depth-first traversal logic in Java. 🌱 Improved code readability by modularizing recursive functions. #LeetCode #DataStructures #BinaryTree #Recursion #Java #CodingChallenge #100DaysChallenge #Day4
To view or add a comment, sign in
-
-
💻 Day 75 of #100DaysOfCodingChallenge ✨ Problem: 560. Subarray Sum Equals K 📚 Category: Array Manipulation | Subarray Problems 💡 Approach: Brute Force 🧠 Language: Java 🔍 Problem Understanding: We’re given an integer array nums and an integer k. We need to count how many subarrays (continuous parts of the array) have a sum equal to k. Example: Input: nums = [1, 2, 3], k = 3 Output: 2 Explanation: [1,2] and [3] are the subarrays with sum 3. 🧠 Brute Force Approach: In the brute-force method, we check every possible subarray using two loops: 1️⃣ Start from each element as a subarray beginning. 2️⃣ Keep adding elements until the end, and check if the sum equals k. 3️⃣ If yes, increment the count. Although it’s not the most optimized, this approach helps build a strong foundation in understanding subarray logic. ⚙️ Complexity: Time Complexity: O(n²) Space Complexity: O(1) 🌱 Learning: This problem taught me how to approach subarray-based questions step-by-step — starting from brute force before moving toward optimized solutions like prefix sums + hashmaps. Building clarity in fundamentals always makes optimization easier later 🚀 #Day75 #100DaysOfCode #LeetCode #Java #ProblemSolving #CodingJourney #WomenInTech #DSA #ArrayManipulation
To view or add a comment, sign in
-
-
🗓 Day 8 / 100 – #100DaysOfLeetCode 📌 Problem 474: Ones and Zeroes The task was to determine the largest subset of binary strings that can be formed using at most m zeros and n ones — essentially a two-dimensional 0/1 Knapsack problem. 🧠 My Approach (in Java): Counted the number of zeros and ones in each string. Used a 2D DP array dp[m][n] to store the maximum subset size possible with given zeros and ones. Iterated in reverse order to ensure each string is only used once (knapsack-style update). Updated states using dp[i][j] = max(dp[i][j], dp[i - zeros][j - ones] + 1). ⏱ Time Complexity: O(len(S) × M × N) 💾 Space Complexity: O(M × N) 💡 Key Learning: This problem strengthened my understanding of multi-dimensional DP — especially how to translate real-world constraints into DP states. It’s a great reminder that mastering DP isn’t about memorizing patterns but about building intuition on state transitions and decisions. Consistent effort. Deep learning. Step by step 🚀 #100DaysOfLeetCode #LeetCodeChallenge #Java #DynamicProgramming #Knapsack #Algorithms #ProblemSolving #DataStructures #DSA #CodingJourney #CompetitiveProgramming #SoftwareEngineering #LearningInPublic #DeveloperJourney #TechStudent #LogicBuilding #CodingCommunity #CodeEveryday #CareerGrowth #Optimization #KeepLearning
To view or add a comment, sign in
-
-
Day 80 of #100DaysOfCode Solved Frequency Sort in Java 🔠 Approach Today's problem was to sort an array based on the frequency of its numbers. My initial solution was accepted, but it exposed a major efficiency gap! My strategy involved: Sorting the array first. Using nested loops to count the frequency of each number and store it in a HashMap. (Implied) Using the counts to perform the final custom sort. The core issue was the counting method: running a full loop inside another full loop to get the frequency. This quadratic $O(N^2)$ counting completely tanked the performance. ✅ Runtime: 29 ms (Beats 12.02%) ✅ Memory: 45.26 MB (Beats 5.86%) Another great lesson in algorithmic complexity! The difference between $O(N^2)$ and the optimal $O(N \log N)$ for this problem is massive. Time to refactor and implement the fast, single-pass $O(N)$ frequency count using getOrDefault! 💪 #Java #100DaysOfCode #LeetCode #CodingChallenge #Algorithms #Arrays #HashMap #Optimization #ProblemSolving
To view or add a comment, sign in
-
-
💡 LeetCode 3110 – Score of a String 💡 Today, I solved LeetCode Problem #3110: Score of a String, a neat little challenge that emphasizes understanding of ASCII values and absolute differences in Java strings. 🔠✨ 🧩 Problem Overview: You’re given a string s. The score of the string is defined as the sum of the absolute differences between the ASCII values of consecutive characters. Return the total score. 👉 Example: Input → "hello" Output → 13 Explanation → |'e'-'h'| + |'l'-'e'| + |'l'-'l'| + |'o'-'l'| = 3 + 7 + 0 + 3 = 13 💡 Approach: 1️⃣ Initialize a variable sum to store the total score. 2️⃣ Traverse the string from index 1 to end. 3️⃣ For each pair of consecutive characters, find their ASCII difference using Math.abs(). 4️⃣ Add the difference to sum and return it. ⚙️ Complexity Analysis: ✅ Time Complexity: O(n) — Single traversal of the string. ✅ Space Complexity: O(1) — Constant extra space. ✨ Key Takeaways: Strengthened understanding of character encoding and ASCII values. Reinforced clean looping logic and mathematical precision in Java. A great example of how simplicity can elegantly solve a real problem. 🌱 Reflection: Even the smallest coding challenges help sharpen attention to detail — from understanding data types to leveraging built-in functions effectively. Consistency is what transforms learning into mastery. 🚀 #LeetCode #3110 #Java #StringManipulation #ASCII #ProblemSolving #DSA #CodingJourney #CleanCode #AlgorithmicThinking #ConsistencyIsKey
To view or add a comment, sign in
-
-
🚀 Day 60 of #100DaysOfCode 🚀 Today, I solved LeetCode Problem #137 – Single Number II 🧩 📘 Problem Statement: Given an integer array where every element appears three times except for one that appears exactly once, find that single element and return it. The challenge: solve it with O(n) time and O(1) space complexity. 💻 Language: Java ⚡ Runtime: 0 ms — Beats 100.00% 📉 Memory: 45.54 MB — Beats 56.30% 🧠 Concept Used: 🔹 Bit Manipulation — A powerful yet tricky technique that leverages binary operations to track occurrences of bits efficiently. 🔹 Instead of using extra space or hash maps, we track bits that appear once and twice using two integer variables: ✅ once → bits that appeared once ✅ twice → bits that appeared twice The trick lies in updating them using XOR (^) and NOT (~) to "cancel out" bits appearing three times. 🧩 Approach Summary: 1️⃣ Initialize two variables once = 0 and twice = 0. 2️⃣ For every number in the array: - Update once and twice based on how many times a bit has appeared. 3️⃣ After processing all numbers, once holds the value of the single element. ✅ Complexity: Time: O(n) Space: O(1) ✨ Takeaway: This problem teaches how bitwise logic can replace traditional data structures, achieving the same result with constant space — a crucial optimization in system-level programming and interviews. #100DaysOfCode #LeetCode #Java #BitManipulation #ProblemSolving #CleanCode #DataStructures #Algorithms #TechLearning #CodingChallenge #SoftwareEngineering #InterviewPreparation
To view or add a comment, sign in
-
-
🚀 Turning Code into Strategy Just wrapped up a fun exercise in algorithmic thinking: finding the best day to buy and sell for maximum profit using Java! This snippet dives into a classic problem—optimizing transactions based on price fluctuations. 📈 Input: {3, 1, 4, 0, 7, 5} 💡 Output: Maximum Profit: 8 | Buy Day: 1 | Sell Day: 7 It’s a great reminder that behind every smart decision is a smart algorithm. #Java #ProblemSolving #Algorithms #CodingJourney #TechInsights #LinkedInLearning
To view or add a comment, sign in
-
-
Today I worked on the problem "Convert Sorted List to Binary Search Tree" in Java — a perfect blend of Linked List and Tree logic! 🌳 🔍 Key Concepts Covered: Finding the middle element of a Linked List using the slow & fast pointer approach Recursively constructing a height-balanced BST Strengthening understanding of Divide and Conquer strategies This problem really sharpened my thinking around recursive structures and pointer management — small yet powerful steps toward writing more efficient and elegant Java code. 💻✨ 💬 What’s your favorite data structure to work with — Linked Lists or Trees? #LeetCode #Java #DataStructures #Algorithms #CodingJourney #LearningEveryday #ProblemSolving #SoftwareEngineering
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