Day 196 of my coding journey. Today I worked on four LeetCode problems to improve my search logic. In LeetCode 34 I learned how to find the first and last position of a target number. I used binary search twice to find the start and end boundaries. This is much faster than checking every number in the list. In LeetCode 852 I found the peak index in a mountain array. By comparing middle elements with their neighbors I could see if the values were increasing or decreasing. This helped me find the top of the mountain quickly. In LeetCode 540 I found a single element in a sorted array where every other number has a pair. I used the count of elements on each side to decide where the single number is hidden. If the count is even or odd it tells me which way to search. In LeetCode 658 I found the K closest elements to a specific value. This taught me how to use binary search to find the best starting point for a range of numbers. It is a very clever way to pick a slice of an array. Binary search is not just for finding a number. It is also great for finding boundaries and specific patterns in data. #DSAinJavaScript #365daysOfCoding #JavaScriptLogic #LeetCode #CodingJourney #SoftwareEngineering #BinarySearch #ProblemSolving #Algorithms #TechLearning #JavaScriptDeveloper #DailyCoding #ProgrammingLife #WebDev #LogicBuilding #AlgorithmDesign #CodeOptimization #ComputerScience #JSProgramming #DeveloperCommunity #ProgrammingLogic #DataStructures
Improving search logic with LeetCode problems
More Relevant Posts
-
🚀 LeetCode Problem I Enjoyed Solving Today I solved one of my favorite grid problems from LeetCode: "Minimum Swaps to Arrange a Binary Grid". Problem Idea💡 We are given an n × n binary grid and need to arrange the rows so that for every row i, there are at least n - i - 1 trailing zeros. We can only swap adjacent rows, and the goal is to minimize the number of swaps. 🔍 Key steps Instead of manipulating the entire grid repeatedly, we can: Compute the number of trailing zeros in each row. For row i, we need at least n - i - 1 trailing zeros. Find a row below that satisfies this condition. Bubble it up using adjacent swaps. If no such row exists → return -1. 💡 Why I liked this problem This question nicely combines: Greedy thinking Array manipulation Simulation of swaps It also teaches how precomputing useful metrics (like trailing zeros) can simplify a complex problem. Problems like this remind me why I enjoy problem solving. Happy Coding!!✌️ #LeetCode #DataStructures #Algorithms #DSA #CodingInterview
To view or add a comment, sign in
-
-
🚀 Day 27/60 — LeetCode Discipline Problem Solved: Length of Last Word Difficulty: Easy Today’s problem looked simple, yet it emphasized a subtle but important skill — handling edge cases cleanly. The goal was to find the length of the last word in a string, ignoring any trailing spaces. Instead of splitting the string or using extra space, the solution efficiently traverses from the end, skipping unnecessary characters and counting only what truly matters. It’s a reminder that strong coding is not always about complexity — sometimes, it’s about precision and clarity in small details. 💡 Focus Areas: • Practiced string traversal from end • Improved handling of trailing spaces • Reinforced clean and efficient logic • Avoided unnecessary extra space usage • Strengthened edge-case thinking ⚡ Performance Highlight: Achieved 0 ms runtime (100% performance). Small problems, when approached with discipline, sharpen the instincts that solve big ones. #LeetCode #60DaysOfCode #100DaysOfCode #DSA #Strings #Algorithms #ProblemSolving #CodingJourney #SoftwareEngineering #Java #Developers #Consistency #TechJourney #LearnToCode
To view or add a comment, sign in
-
-
I always feared LeetCode problems because I studied arrays deeply, and I could create most standard array methods like Display, Add(el), Append(el or arr), Insert(index), Delete(el), Max(arr), Min(arr), etc. But when I tried to solve LeetCode problems, I froze. Then I found that these are the secrets to solving those problems. I studied every given technique, and now I know how developers solve them. The only thing left is to practice many questions.
To view or add a comment, sign in
-
-
Another Day, Another Level Up! 💻 Today’s live coding session was packed with amazing concepts! I learned how to make my code cleaner, smarter, and more efficient. Here is a quick summary of what I learned today: Classes & Error Handling: Mastered the basics of classes and how to handle errors properly so the app doesn't crash. 🛠️ Promises: Learned how to manage tasks that take time (Asynchronous JS) using Promises. ⏳ Symbols: Explored this unique data type and how it helps in creating private-like properties. 🔑 Iterables with Symbols: Used Symbol.iterator to make objects behave like arrays so we can loop through them! 🔄 Overwriting Functions: Learned how to use Symbols to overwrite or customize default function behaviors in objects. ✍️ Feeling more confident with JavaScript every day. Step by step, I'm getting closer to becoming a better developer! 💪 Hitesh Choudhary, Piyush Garg, Chai Aur Code, Akash Kadlag, Jay Kadlag #JavaScript #WebDevelopment #CodingJourney #LearningEveryDay #MERNStack #Programming
To view or add a comment, sign in
-
-
Day 80 - LeetCode Journey 🚀 Solved LeetCode 876: Middle of the Linked List (Easy) — a classic problem that introduces one of the most powerful patterns in linked lists. At first, finding the middle seems straightforward. But doing it efficiently in a single pass is where the real insight comes in. 💡 Core Idea (Slow & Fast Pointer Technique): Initialize two pointers: slow and fast Move slow by 1 step and fast by 2 steps When fast reaches the end, slow will be at the middle If there are two middle nodes, this approach naturally returns the second one. 🤯 Why it works? Because the fast pointer covers double the distance of the slow pointer, so when it finishes traversing the list, the slow pointer is exactly halfway. ⚡ Key Learning Points: • Efficient single-pass traversal • Mastering the slow-fast pointer pattern • Handling even and odd length lists • Achieving O(n) time and O(1) space • Building intuition for pointer-based problems This is a foundational pattern used in many advanced problems. Also, this pattern connects with: Linked List Cycle detection Palindrome Linked List Reorder List Finding intersection of two linked lists ✅ Stronger grasp of two-pointer technique ✅ Better problem-solving efficiency ✅ Cleaner and optimized linked list logic Simple problem, powerful pattern — this is how concepts build up 🚀 #LeetCode #DSA #Java #LinkedList #TwoPointers #Algorithms #ProblemSolving #CodingJourney #Consistency #100DaysOfCode #InterviewPreparation #DeveloperGrowth #KeepCoding
To view or add a comment, sign in
-
-
💻 Behind the Scenes of CashGo – Code Overview Here’s a quick look at the code structure and development process of my project CashGo, which I built during the Django Workshop Hackathon organized by Techno Future India. In this video, I’m sharing how the project was developed using Django and Python, including: • Project structure • Backend logic • Database integration using SQL • Frontend development using HTML, CSS, and JavaScript Building this project helped me gain practical experience in full-stack web development using Django. Excited to continue learning and building more projects! #Python #Django #Coding #WebDevelopment #StudentDeveloper #VignansNirulaInstituteOfTechnologyAndScienceForWomen
To view or add a comment, sign in
-
Day 22/90 — Shipped to Production 🚀Sheryians Coding School Today was a big day. Not just building features — but actually deploying CodeForge to production on Render. Here's what got done today: Features shipped: Profile picture upload with dropdown menu (logout + update avatar) Solo Session — language selection modal before entering editor Works page — lists all your solo coding sessions with real timestamps Web IDE powered by Sandpack — file + folder creation, live preview Team page + Docs page — because a product needs more than just code Java boilerplate fix — Judge0 requires public class Main, now handled Deployment: Frontend build served from backend (same domain = no cookie issues) Fixed cross-domain cookie problem that was killing sessions Email verification bypassed for now — any email can register and login Render logs are clean ✅ What I learned: Render free tier blocks SMTP ports. Spent way too long debugging nodemailer before switching to Resend. Sometimes the right move is just switching tools, not fighting infrastructure. 22 days in. Product is live. People can actually use it now. That's the real milestone. Tech: React · Node.js · MongoDB · Socket.IO · Sandpack · Render #buildinpublic #day22of90 #fullstackdevelopment #codeforge #mern
To view or add a comment, sign in
-
One Command to Build a NestJS Resource! 🚀 Did you know you can create a full feature in NestJS with just one command? Type this in your terminal: $ nest g resource product It automatically creates everything for you: ✅ Controller: To handle requests. ✅ Service: To handle logic. ✅ Module: To organize the code. ✅ Entity: For the database structure. ✅ DTOs: For data validation. No more creating files one by one. It’s fast, clean, and saves so much time! Have you tried this command yet?🤔 Let me know in the comments! 👇 #NestJS #Coding #WebDev #Backend #Programming
To view or add a comment, sign in
-
-
I’ve been preparing for LeetCode-style live coding interviews for the past 7 days. Here is what I learned: First of all, it’s really hard the first time you do it. You could have seen people on YT saying you just need to learn N patterns. That’s partly true: patterns help, but to truly spot them when solving problems, you just need A LOT OF PRACTICE. What worked for me was training in batches. Over the last year, I practiced 4 separate times, each with 2-3 months' breaks in between. Interestingly, after coming back from a break and seeing the same problems again, sometimes the solution idea would immediately click, at least an approach or a data structure. It’s not guaranteed, but repetition really helps. This video is essential if you are starting your learning path: https://lnkd.in/dVX6QkhR Some lessons I learned: - Don’t start with random problems. Follow a structured list like NeetCode 75. - Try to solve the problem yourself for at least 10 minutes. Even if you fail, you’ll understand the problem and its pitfalls much better. - If you can’t solve it, watch the solution and make sure you understand it. Code yourself, don't just copy. Often idea is enough for you to code it. Then ask GPT for similar problems and try them on your own. - Think out loud. Even when practicing alone. It may feel strange, but it helps organize your thoughts and prepares you for real interviews. - Don’t forget to analyze time and space complexity. That’s part of the interview. - Start with a simple solution first, even if it’s not efficient. Then optimize. - Don’t hesitate to ask for syntax help or validation during interviews. - Use a language that doesn’t slow you down. Python is great for this. Learning LeetCode in a language like Rust might complicate things because you’ll spend time on language issues instead of algorithms. I’m still learning, too, though. Good luck to all of us applying.
How I would learn Leetcode if I could start over
https://www.youtube.com/
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