𝗗𝗮𝘆 𝟮𝟵/𝟭𝟬𝟬 | 𝗟𝗲𝗻𝗴𝘁𝗵 𝗼𝗳 𝗟𝗮𝘀𝘁 𝗪𝗼𝗿𝗱 Day 29 ✅ — One day away from a full month. Sometimes simple is powerful. 𝗧𝗼𝗱𝗮𝘆'𝘀 𝗣𝗿𝗼𝗯𝗹𝗲𝗺: ✅ 𝗣𝗿𝗼𝗯𝗹𝗲𝗺 #𝟱𝟴: Length of Last Word (Easy) 𝗪𝗵𝗮𝘁 𝗖𝗹𝗶𝗰𝗸𝗲𝗱: Find the length of the last word in a string. Sounds simple, but edge cases make it interesting: Trailing spaces: "Hello World " Leading spaces: " Hello" Multiple spaces between words The efficient approach? 𝗧𝗿𝗮𝘃𝗲𝗿𝘀𝗲 𝗳𝗿𝗼𝗺 𝘁𝗵𝗲 𝗲𝗻𝗱. Skip trailing spaces, count characters until you hit another space. 𝗠𝘆 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵: 👉 Start from the end of the string 👉 Skip all trailing spaces 👉 Count characters until next space 👉 Return count Time complexity: O(n), Space complexity: O(1) One pass. No split(). No extra space. 𝗠𝘆 𝗥𝗲𝗮𝗹𝗶𝘇𝗮𝘁𝗶𝗼𝗻: Easy problems teach you to handle edge cases cleanly. String manipulation might seem basic, but it's tested in every coding interview. The difference between junior and senior developers? Handling edge cases without being told. 29 days in, and I'm paying attention to the details that matter. 𝗖𝗼𝗱𝗲: https://lnkd.in/gBXpSzgy 𝟮𝟵 𝗱𝗮𝘆𝘀. 𝗧𝗼𝗺𝗼𝗿𝗿𝗼𝘄 𝗺𝗮𝗿𝗸𝘀 𝗼𝗻𝗲 𝗳𝘂𝗹𝗹 𝗺𝗼𝗻𝘁𝗵. Almost there. Consistency compounds. 𝗗𝗮𝘆 𝟮𝟵/𝟭𝟬𝟬 ✅ | 𝟳𝟭 𝗺𝗼𝗿𝗲 𝘁𝗼 𝗴𝗼! #100DaysOfCode #LeetCode #StringManipulation #EdgeCases #CodingInterview #Java #Algorithms #SoftwareEngineer #ProblemSolving #CleanCode #TechnicalInterview #Programming #DataStructures #TimeComplexity #TechCareers
More Relevant Posts
-
𝗗𝗮𝘆 𝟯𝟮/𝟭𝟬𝟬 | 𝗥𝗲𝗺𝗼𝘃𝗲 𝗡𝘁𝗵 𝗡𝗼𝗱𝗲 𝗙𝗿𝗼𝗺 𝗘𝗻𝗱 𝗼𝗳 𝗟𝗶𝘀𝘁 Day 32 ✅ — Three linked list problems in a row. The pattern is clear. 𝗧𝗼𝗱𝗮𝘆'𝘀 𝗣𝗿𝗼𝗯𝗹𝗲𝗺: ✅ 𝗣𝗿𝗼𝗯𝗹𝗲𝗺 #𝟭𝟵: Remove Nth Node From End of List (Medium) 𝗪𝗵𝗮𝘁 𝗖𝗹𝗶𝗰𝗸𝗲𝗱: Remove the nth node from the end of a linked list in one pass... or two. The tricky part? We don't know the size upfront. My approach: first calculate the size, then find the exact node to remove. Key edge case that almost caught me: removing the head node itself (when n equals the list size). Had to handle that separately. 𝗠𝘆 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵: 👉 First pass: calculate the total size of the linked list 👉 If n equals size, remove head directly 👉 Traverse to the node just before the target 👉 Skip the target node: curr.next = curr.next.next Time complexity: O(n), Space complexity: O(1) 𝗠𝘆 𝗥𝗲𝗮𝗹𝗶𝘇𝗮𝘁𝗶𝗼𝗻: This is a two-pass solution. There's also a one-pass two-pointer technique using fast and slow pointers—something I want to explore next. But here's what matters: my solution works, is clean, and handles all edge cases. Understanding multiple approaches to the same problem is what separates good developers from great ones in technical interviews. Three linked list problems back-to-back (Day 30, 31, 32) and the pointer manipulation is becoming second nature. 𝗖𝗼𝗱𝗲: https://lnkd.in/g5EEbZKW 𝟯𝟮 𝗱𝗮𝘆𝘀. 𝗟𝗶𝗻𝗸𝗲𝗱 𝗹𝗶𝘀𝘁 𝗺𝗮𝘀𝘁𝗲𝗿𝘆 𝘂𝗻𝗹𝗼𝗰𝗸𝗲𝗱. 𝗗𝗮𝘆 𝟯𝟮/𝟭𝟬𝟬 ✅ | 𝟲𝟴 𝗺𝗼𝗿𝗲 𝘁𝗼 𝗴𝗼! #100DaysOfCode #LeetCode #LinkedList #PointerManipulation #TwoPointer #DataStructures #CodingInterview #TechnicalInterview #FAANG #SoftwareEngineer #Java #Algorithms #EdgeCases #ComputerScience #Programming #TechCareers #Consistency
To view or add a comment, sign in
-
𝗗𝗮𝘆 𝟰𝟬/𝟭𝟬𝟬 | 𝗗𝗼𝘂𝗯𝗹𝗲 𝗮 𝗡𝘂𝗺𝗯𝗲𝗿 𝗥𝗲𝗽𝗿𝗲𝘀𝗲𝗻𝘁𝗲𝗱 𝗮𝘀 𝗮 𝗟𝗶𝗻𝗸𝗲𝗱 𝗟𝗶𝘀𝘁 🎉 Day 40 ✅ — 𝟰𝟬% 𝗰𝗼𝗺𝗽𝗹𝗲𝘁𝗲. 𝗘𝗹𝗲𝘃𝗲𝗻 𝗹𝗶𝗻𝗸𝗲𝗱 𝗹𝗶𝘀𝘁 𝗽𝗿𝗼𝗯𝗹𝗲𝗺𝘀 𝘀𝘁𝗿𝗮𝗶𝗴𝗵𝘁. 𝗧𝗼𝗱𝗮𝘆'𝘀 𝗣𝗿𝗼𝗯𝗹𝗲𝗺: ✅ 𝗣𝗿𝗼𝗯𝗹𝗲𝗺 #𝟮𝟴𝟭𝟲: Double a Number Represented as a Linked List (Medium) 𝗪𝗵𝗮𝘁 𝗖𝗹𝗶𝗰𝗸𝗲𝗱: Double a number stored in a linked list (digits in order). Handle carry propagation like manual multiplication. My approach combined patterns from the past 11 days: Reverse the list (Day 31, 39) Process digit by digit with carry Reverse back to original order Three operations, one solution. The linked list fundamentals are locked in. 𝗠𝘆 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵: 👉 Reverse the linked list 👉 Multiply each digit by 2, handle carry 👉 If final carry exists, add new node 👉 Reverse back to original order Time: O(n), Space: O(1) 𝗠𝘆 𝗥𝗲𝗮𝗹𝗶𝘇𝗮𝘁𝗶𝗼𝗻: Eleven consecutive linked list problems (Day 30-40). What started as practice became mastery. 40 days. 40 problems. 40% complete. The consistency compounds. 𝗖𝗼𝗱𝗲:🔗 https://lnkd.in/gbmeVK36 𝟰𝟬 𝗱𝗮𝘆𝘀. 𝗧𝘄𝗼-𝗳𝗶𝗳𝘁𝗵𝘀 𝗱𝗼𝗻𝗲. 🎯 To everyone on their journey: small daily actions → massive results. Keep going. 𝗗𝗮𝘆 𝟰𝟬/𝟭𝟬𝟬 ✅ | 𝟲𝟬 𝗺𝗼𝗿𝗲 𝘁𝗼 𝗴𝗼! #100DaysOfCode #LeetCode #LinkedList #MathematicalAlgorithms #DataStructures #CodingInterview #SoftwareEngineer #Java #Algorithms #MediumLevel #Programming #40DayMilestone #Consistency #TechCareers
To view or add a comment, sign in
-
𝗟𝗲𝗲𝘁𝗖𝗼𝗱𝗲 𝗤𝘂𝗲𝘀𝘁𝗶𝗼𝗻𝘀 𝗳𝗼𝗿 𝗗𝗲𝘃𝗲𝗹𝗼𝗽𝗲𝗿𝘀 – 𝗠𝗮𝘀𝘁𝗲𝗿 𝗖𝗼𝗱𝗶𝗻𝗴 𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄𝘀 𝘄𝗶𝘁𝗵 𝗣𝗿𝗮𝗰𝘁𝗶𝗰𝗲 𝗣𝗿𝗼𝗯𝗹𝗲𝗺𝘀 Boost your problem-solving skills with essential LeetCode questions every developer should practice. This guide covers popular coding problems from arrays, strings, linked lists, stacks, queues, trees, graphs, recursion, and dynamic programming. Perfect for developers preparing for technical interviews at top tech companies. Improve your logic, coding speed, and confidence by practicing real interview-level problems with structured learning. #LeetCode #CodingInterview #DSA #ProblemSolving #SoftwareEngineering #ProgrammingPractice #TechInterviews #Developers #Algorithms #DataStructures #InterviewPreparation #CodeWithGandhi
To view or add a comment, sign in
-
Everyone’s hugging people. I’m hugging my for-loop today. 🤝💻 It’s Hug Day… and instead of chocolates and roses, I shipped one of the most fun (and painful) features of my Valentine Build Sprint. Today’s update on CodeRecall: I built a step-by-step code execution visualizer for Java and C++. You paste any snippet even a function-based one and it automatically: • detects the language (Java / C++) • finds the entry function • generates the best possible dry-run inputs • executes the code step by step • shows variable changes, arrays, and output • captures return values • and highlights the current line as it runs No backend. No execution APIs. Pure frontend interpreter. What makes this harder (and more interesting): The snippets students save are not always full programs. Most of the time they’re just functions. So I had to build a system that: understands the function, creates synthetic inputs, builds a runnable flow, and visualizes it safely with limits for loops and steps. On the AI side, I also fixed a nasty issue today: my Gemini integration kept failing during this sprint, so I finally migrated the AI layer to Groq and added multi-key fallback and retries to make CodeRecall production-safe. This is part of my 7-day Valentine build sprint. Try it here and break it: 👉 https://lnkd.in/dS4fSvf6 If you’re a student who revises DSA or CP problems, I’d genuinely love your feedback on the visualizer. #HugDay #ValentineBuildSprint #CodeRecall #BuildingInPublic #StudentBuilders #WebDevelopment #Java #Cpp #DSA
To view or add a comment, sign in
-
🚀 Today’s LeetCode Problem — Sort Integers by Number of 1 Bits Let’s solve today’s LC in story mode 🎭 Imagine numbers are contestants in a Binary Costume Contest. Today’s contestants: 👉 [5, 3, 7] But this contest has a twist 👇 👨⚖️ The judge doesn’t care about the number itself first. He cares about… 🎈 How many 1s are in their binary costume 🎭 What Are They Wearing? 🔹 5 → 101 → 🎈🎈 (2 ones) 🔹 3 → 011 → 🎈🎈 (2 ones) 🔹 7 → 111 → 🎈🎈🎈 (3 ones) 🏆 Judge’s Rules 1️⃣ Fewer 1s → Higher priority 2️⃣ Same number of 1s → Smaller number wins 👉 Step 1: 3 & 5 → 2 ones 7 → 3 ones So 7 goes last. 👉 Step 2: Tie between 3 and 5 Smaller number first → 3 before 5 ✅ Final Answer: [3, 5, 7] 💡 How I Solved It I implemented this using: 🔹 Brian Kernighan’s Algorithm for efficient bit counting 🔹 TreeMap to maintain sorted order by bit count + value 🔹 Also compared with built-in bitCount() + custom comparator sorting This ensures: ✔ Efficient bit counting ✔ Clean tie-breaking ✔ Optimal sorting logic If you’re interested, I’ve pushed the complete solution (Kernighan + TreeMap + built-in approach) : https://lnkd.in/gV9HZ9w4 👨💻 Would love feedback from fellow developers 🙌 #LeetCode #DSA #Java #ProblemSolving #CodingJourney #100DaysOfCode #Tech #SoftwareEngineering
To view or add a comment, sign in
-
-
Day 32 Efficiency through Swapping: Permutations Optimized ✅ I tackled the Permutations problem on LeetCode using an optimized Backtracking approach that focuses on in-place swaps rather than extra space. The Technical Breakdown: In-Place Swapping: Instead of using a List or a boolean[] to track visited elements, I used the array itself. By swapping the current element with the start index, I effectively "fixed" one position and moved to the next. Recursive Exploration: After fixing an element at the start position, the algorithm recurses to find all permutations for the remaining subarray (start + 1). The Backtrack Step: The second swap(nums, start, i) is the most critical part. It restores the original array state so the loop can move to the next element and explore a completely different branch of the decision tree. Space Optimization: This approach is much more memory-efficient as it avoids the overhead of creating multiple temporary data structures, operating directly on the input array. It’s a great example of how re-thinking the way we "choose" elements can lead to a much leaner and faster algorithm! 🚀 A huge thanks to my mentor, Anchal Sharma and Ikshit .. for the incredible support and for helping me stay consistent on this journey. Having that accountability makes all the difference! #DSA #Java #100DaysOfCode #Backtracking #Recursion #Permutations #ProblemSolving #Mentorship #LeetCode #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀 𝐉𝐚𝐯𝐚 𝐓𝐡𝐫𝐞𝐚𝐝 𝐋𝐢𝐟𝐞 𝐂𝐲𝐜𝐥𝐞 – 𝐄𝐱𝐩𝐥𝐚𝐢𝐧𝐞𝐝 𝐋𝐢𝐤𝐞 𝐑𝐞𝐚𝐥 𝐋𝐢𝐟𝐞! Have you ever noticed how we humans go through different stages in a day? 𝑾𝒆 𝒘𝒂𝒌𝒆 𝒖𝒑 😴 → 𝒈𝒆𝒕 𝒓𝒆𝒂𝒅𝒚 → 𝒔𝒕𝒂𝒓𝒕 𝒘𝒐𝒓𝒌𝒊𝒏𝒈 → 𝒘𝒂𝒊𝒕 𝒇𝒐𝒓 𝒔𝒐𝒎𝒆𝒕𝒉𝒊𝒏𝒈 → 𝒇𝒊𝒏𝒊𝒔𝒉 𝒘𝒐𝒓𝒌 → 𝒈𝒐 𝒕𝒐 𝒔𝒍𝒆𝒆𝒑. Interestingly, a Thread in Java follows a very similar life cycle! Let’s understand it in the simplest way possible 👇 In Java, a Thread is like a small worker inside your program that performs a task. 🟢 1. 𝐍𝐞𝐰 (𝐁𝐨𝐫𝐧 𝐒𝐭𝐚𝐠𝐞) When you create a thread using new Thread(), it is just created. It’s like a person who has woken up but hasn’t started working yet. 🟡 2. 𝐑𝐮𝐧𝐧𝐚𝐛𝐥𝐞 (𝐑𝐞𝐚𝐝𝐲 𝐭𝐨 𝐑𝐮𝐧) When you call start(), the thread becomes ready to run. It’s like reaching the office and waiting for your manager to assign work. 🔵 3. 𝐑𝐮𝐧𝐧𝐢𝐧𝐠 Now the thread is actively executing its task. This is the “doing the actual work” stage. 🟠 4. 𝐖𝐚𝐢𝐭𝐢𝐧𝐠 / 𝐁𝐥𝐨𝐜𝐤𝐞𝐝 Sometimes a thread has to wait — maybe for another task to finish or for some resource. Just like waiting for a reply to an important email. 🔴 5. 𝐓𝐞𝐫𝐦𝐢𝐧𝐚𝐭𝐞𝐝 (𝐃𝐞𝐚𝐝) Once the task is completed, the thread finishes its life cycle. Work done. Day over. 😌 💡 Why does this matter? Because understanding thread life cycle helps you: ✔ Write better multi-tasking programs ✔ Improve performance ✔ Avoid errors like deadlocks ✔ Think like a real software engineer Threads are not just technical concepts — they reflect how real life works. If this explanation made threads simpler for you, drop a 👍 in the comments! And tell me — should I explain Multithreading in the same simple way next? 😊 #Java #Multithreading #Programming #SoftwareDevelopment #TechForEveryone
To view or add a comment, sign in
-
-
Day 36 :- Binary Search & Range Finding: Find First and Last Position of Element ✅ Today’s DSA session was a great exercise in extending the classic Binary Search to handle multiple occurrences of a target value. I tackled LeetCode 34. Find First and Last Position of Element in Sorted Array, focusing on how to efficiently pinpoint a range within a sorted dataset. The Technical Breakdown: Hybrid Search Strategy: I started with a standard Binary Search to find any instance of the target. This immediately gives us an O(log n) starting point. Linear Expansion: Once the target was found, I used two pointers to expand outward from the meeting point. This identifies the exact boundaries where the target values start and end. Edge Case Handling: The logic naturally handles cases where the target isn't present by returning [-1, -1], and it manages single-element arrays or cases where the target spans the entire array. The Trade-off: While this approach is very intuitive, it can reach O(n) in the worst case (e.g., an array of all identical numbers). It’s a great stepping stone before diving into the pure O(log n) approach of finding the "leftmost" and "rightmost" indices independently! It's a solid reminder that Binary Search isn't just for finding a single value—it's the foundation for navigating any sorted range! 🚀 A huge thanks to my mentor, Anchal Sharma and Ikshit .. for the incredible support and for helping me stay consistent on this journey. Having that accountability makes all the difference! #DSA #Java #100DaysOfCode #BinarySearch #TwoPointers #ProblemSolving #Mentorship #LeetCode #SoftwareEngineering
To view or add a comment, sign in
-
-
🔍 Two Sum Problem: Approach, A Subtle Twist, and What It Taught Me The Approach: Given an array nums and a target, we want to find indices of two numbers that sum to the target. How do we solve it efficiently? Use a map to store numbers and their indices. Iterate through the array: For each number num, check if target - num is already in the map. If yes, return the pair of indices. If not, store the current number and its index in the map. The Twist I Encountered: Take the array: [3,3,4,6,7,7] with target = 9 The pair (3, 6) appears twice if we consider the two different 3s: (nums[0], nums[3]) = (3, 6) (nums[1], nums[3]) = (3, 6) When I ran the solution as-is, the map kept updating the index for 3 — basically overwriting the first occurrence with the second. This meant the returned indices were [1, 3] instead of [0, 3]. The Realization: Initially, this made me wonder: Should we return the pair with the first occurrence? Or is any valid pair acceptable? Turns out, the classic Two Sum problem allows any valid pair — so [1,3] is perfectly acceptable. But if your use case requires the earliest pair, a simple tweak fixes it: Only add a number to the map if it’s not already stored (preserving the first occurrence). What I Learned: ✔️ Solutions should always be aligned with problem requirements, not assumptions. ✔️ Sometimes, small data structure details (like overwriting keys) can subtly change your outputs. ✔️ Clarifying expected outputs early can save confusion later. Have you encountered similar small but impactful nuances in coding challenges? Would love to hear your thoughts! #programming #coding #algorithms #datastructures #problemSolving #softwareengineering #javascript #developer #leetcode #codingchallenge #algorithmdesign #hashmap #codingtips #DSA #algorithmicthinking #softwaredeveloper #interviewprep #codinginterviews #programmerlife #tech
To view or add a comment, sign in
-
🚀 Introducing PatternForge: A DSA Pattern Code Generator I’m excited to share PatternForge, a full stack web application I built to help students understand and practice DSA pattern problems in a smarter and more visual way. 👉 The idea Many learners can recognize a pattern visually but struggle to convert it into nested loops and clean, structured code. PatternForge is designed to bridge that gap. 💡 What PatternForge does • Accepts ASCII pattern inputs such as stars, numbers, and pyramids • Automatically detects the pattern type • Generates production-ready code in Python, Java, C++, and JavaScript • Provides step-by-step explanations along with time and space complexity and difficulty level ✨ Key features • Smart recognition of more than twenty pattern types • Support for basic, centered, hollow, number, and advanced patterns • Clean, responsive, and modern user interface • One-click code copy for quick usage • REST API for pattern generation • Well-structured backend with modular architecture • Tested using pytest for better reliability 🛠️ Tech stack • Backend: Python and Flask • Frontend: HTML, CSS, and JavaScript • Architecture: Clean separation of pattern detection, code generation, and explanation logic • Testing: Pytest 📚 What I learned • Designing algorithms for pattern recognition • Writing clean, maintainable backend code • Building and documenting REST APIs • Improving frontend user experience with modern CSS • Understanding the importance of testing and clear documentation This project strengthened my understanding of DSA fundamentals, backend development, and system design. PatternForge is built with learners in mind and focuses on making pattern problems easier to understand and implement. 🔗 Live project https://lnkd.in/grF49Hhn I’d love to hear feedback or ideas for improvement, especially from fellow learners and developers. #DSA #Python #Flask #WebDevelopment #ProblemSolving #SoftwareEngineering #LearningByBuilding #Projects #StudentsInTech
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