Day 7/100 ✅ Today's LeetCode problem — Convert Date String to YYYY-MM-DD format 📅 Input: "20th Oct 2052" Output: "2052-10-20" Approach: → Split the string into day, month, year → Strip the suffix (st, nd, rd, th) using isdigit() → Map month name to number using dictionary → Add leading zero with zfill(2) Simple problem but great practice for string manipulation in Python. 🐍 #100DaysOfLeetCode #LeetCode #Python #StringManipulation #DSA #100DaysOfCode
Convert Date String to YYYY-MM-DD in Python
More Relevant Posts
-
Here's what's happening... Output: l 🐍 Did you get it right? The key here is chained indexing — name[0] gives you the string, then [1] digs into that string. Step by step: name[0] → "Ali" (first element of the tuple) "Ali"[1] → "l" (second character of the string, index starts at 0!) ✅ This is called chained indexing. Follow for more Python puzzles 🔥 #python #pythontips #learnpython #pythonprogramming #viral
To view or add a comment, sign in
-
-
Day 50/100 – #100DaysOfCode 🚀 Solved LeetCode #28 – Find the Index of the First Occurrence in a String (Python). Today I practiced string matching using a brute-force approach to find the first occurrence of a substring. Approach: 1) Traverse the main string (haystack). 2) For each index, try to match the substring (needle). 3) Compare characters one by one. 4) If all characters match, return the starting index. 5) If mismatch occurs, break and move to the next index. 6) If no match is found, return -1. Time Complexity: O(n × m) Space Complexity: O(1) Understanding basic string matching techniques step by step 💪 #LeetCode #Python #DSA #Strings #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Day 33/100 – #100DaysOfCode 🚀 Solved LeetCode #1480 – Running Sum of 1d Array (Python). Today I practiced prefix sum logic to compute the running sum of an array. Approach: 1) Initialize an empty list to store the running sum. 2) Maintain a variable sum = 0. 3) Traverse the array and keep adding each element to sum. 4) Append the updated sum to the result list. 5) Return the final running sum array. Time Complexity: O(n) Space Complexity: O(n) Understanding prefix sums helps solve many array problems efficiently 💪 #LeetCode #Python #DSA #Arrays #PrefixSum #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Day 102 Backtracking patterns are starting to repeat. #Day102 🧩 90. Subsets II How today went: • Similar to the basic Subsets problem • Key difference: handling duplicates • Sorting the array is important • While iterating, skip duplicates to avoid repeating subsets What clicked: Backtracking becomes easier when you: • Recognize the base pattern • Add constraints like duplicate handling Same structure, new rule. That’s how patterns build. #LeetCode #DSA #Python #Backtracking #Recursion #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
Beyond String Concatenation When I started, I used to concatenate strings the old-school way. It was messy, prone to errors, and hard to read The Problem: Using + requires manual type conversion (like str(21)) and gets confusing with all the extra quotes and spaces Solution: F-strings Introduced in Python 3.6, F-strings makes your code: ✅ Readable: You see the full sentence structure ✅ Fast: They are more efficient than older methods ✅ Flexible: You can perform math or call methods directly inside { } It’s a small concept, but it’s one of the easiest ways to make code look 10x more professional. #Python #30DaysOfCode #BCA #LearningInPublic #Day21 #JECRC Day 21/30
To view or add a comment, sign in
-
-
Back to consistency 💻🚀 Recently, I worked on implementing Pascal’s Triangle in Python — and it turned out to be a great exercise in logic building. While solving this, I learned: 🔹 How each row depends on the previous one 🔹 Better understanding of nested loops 🔹 Using mathematical logic instead of brute force It’s interesting how such a simple-looking pattern involves deeper thinking behind the scenes. Here’s my implementation 👇 Small steps like these are helping me build a strong foundation in Data Structures & Algorithms. #Python #DSA #CodingJourney #LearningInPublic #100DaysOfCode
To view or add a comment, sign in
-
-
Day 42/100 – #100DaysOfCode 🚀 Solved LeetCode #2574 – Left and Right Sum Differences (Python). Today I practiced prefix sum logic to calculate the absolute difference between left and right sums for each index. Approach: 1) Calculate the total sum of the array. 2) Initialize leftSum = 0. 3) Traverse the array. 4) For each index, compute rightSum = total - leftSum - nums[i]. 5) Calculate the absolute difference and append it to the result. 6) Update leftSum by adding nums[i]. Time Complexity: O(n) Space Complexity: O(n) Understanding prefix sum helps solve problems efficiently 💪 #LeetCode #Python #DSA #Arrays #PrefixSum #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Day 103/200 – LeetCode Challenge. Today’s problem: Subsets II Given an integer array that may contain duplicates, return all possible subsets without duplicate subsets. Handling duplicates is the tricky part. Sort input → groups duplicates together. Use backtracking to explore all subsets. Optimized and clean solution using recursion. How to handle duplicates in subset problems. Importance of sorting in backtracking. Writing efficient recursive solutions. #LeetCode #Python #CodingJourney #Backtracking #200DaysOfCode
To view or add a comment, sign in
-
-
Day 30/100 – #100DaysOfCode 🚀 Solved LeetCode #1299 – Replace Elements with Greatest Element on Right Side (Python). Today I practiced reverse traversal to efficiently replace each element with the greatest element on its right. Approach: 1) Initialize max_right = -1. 2) Traverse the array from right to left. 3) Store the current element in a temporary variable. 4) Replace the current element with max_right. 5) Update max_right as the maximum of max_right and the stored value. 6) Continue until the entire array is processed. Time Complexity: O(n) Space Complexity: O(1) Learning how reverse traversal can simplify problems efficiently 💪 #LeetCode #Python #DSA #Arrays #ProblemSolving #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