I started learning DSA this week. No fancy roadmap, no 6-month plan — just me, JavaScript, and a lot of wrong answers on GFG. Here's what week 1 actually looked like: 🔍 Subset of an array — looks simple until it isn't I thought using a Set was the smart move. Turns out Set only tells you IF a value exists, not HOW MANY times. So when b had duplicate elements that a couldn't cover, my code happily returned true. Wrong. Switched to a frequency map — count occurrences in a, then consume them while checking b. That fixed it. 🐛 The bug that made me stare at my screen for 20 minutes Wrote j > a.length instead of j < a.length in my inner for loop. One character. The loop never ran even once. found stayed false. Everything returned false. I thought my whole logic was broken — it was just a >. 💡 Why does the `found` variable even exist? I kept wondering why I couldn't just check the condition after the inner loop. Then it clicked — the inner loop runs many times, but the outer loop needs one final answer: did we find it or not? found is just a message passed from the inner loop to the outer loop. Simple, but it took me a while. 🔄 Array rotation Left rotation — save first element, shift everything left, place it at the end. Right rotation — save last element, shift everything right, place it at the start. Looks obvious now. Wasn't at first. 📌 1-based vs 0-based indexing on GFG Spent way too long wondering why my correct logic was giving wrong answers. GFG arrays start at index 1, not 0. So instead of arr[i] === i, you need arr[i] === i + 1. One line change, completely different results. 📦 Queue using an array Front pointer, rear pointer, size counter. enqueue moves rear forward, dequeue moves front forward. When size hits 0 — reset both to -1. It finally makes sense why we need all three. None of this came easy. But every bug I fixed actually taught me something. If you're also starting DSA and feeling lost — that's normal. The bugs are part of it. What was the first DSA bug that made you question everything? 👇 #DSA #JavaScript #CodingJourney #LearnToCode #DataStructures #Algorithms #GeeksForGeeks #100DaysOfCode #ProgrammingLife #BeginnerCoder #WebDevelopment #CodeNewbie #ProblemSolving #TechLearning
Learning DSA with JavaScript: Common Pitfalls and Lessons Learned
More Relevant Posts
-
𝗔 𝗦𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗮𝗹 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿 𝗮𝗰𝗾𝘂𝗶𝗿𝗶𝗻𝗴 𝗪𝗲𝗯 𝗗𝗲𝘃 𝗦𝗸𝗶𝗹𝗹𝘀. 𝗗𝗮𝘆 𝟵/𝟵 ✅ 🟢 Python → 🟢 HTML & CSS → 🟢 Web page Deployment/PHP → 🔘 JavaScript → 🔘 React → 🔘 ReactFlow → 🔘 FastAPI ――――――――――――――――――――― Udemy HTML & CSS course — done. 9/9 days of consistent progress from basic tags to full site deployment the foundations are now solid. Once you layer frameworks like React.js / Node.js on top of this, web creation becomes significantly faster. Understanding what's happening underneath makes all the difference when things don't go as expected. Next up: JavaScript — where the web stops being static and starts thinking. #WebDevelopment #CSS #HTML #JavaScript #Python #FullStack #StructuralEngineering #BridgeEngineering #DigitalEngineering #Upskilling #AI
To view or add a comment, sign in
-
-
𝗔 𝗦𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗮𝗹 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿 𝗮𝗰𝗾𝘂𝗶𝗿𝗶𝗻𝗴 𝗪𝗲𝗯 𝗗𝗲𝘃 𝗦𝗸𝗶𝗹𝗹𝘀 — Day 10/100 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗗𝗮𝘆 𝟭/25 ✅ 🟢 Python → 🟢 HTML & CSS → 🟢 JavaScript → 🔘 React → 🔘 ReactFlow → 🔘 FastAPI ――――――――――――――――――――――――――――――― JavaScript runs natively in the browser — it's what makes what we see in web app come alive. Colour changes, click effects, hover animations, all JS. Initially planned 4 days for Fundamentals 1 tutorials. But the language feels so close to Python that I sat straight through the full 4.5 hr session in one go. The overwhelm of web development eases off once you realise the logic is already familiar. Fundamentals 2 is up next — another 4.5 hours. Hoping to cruise through at the same pace. #WebDevelopment #JavaScript #Python #FullStack #StructuralEngineering #BridgeEngineering #DigitalEngineering #Upskilling
To view or add a comment, sign in
-
Let me tell you about a project that taught me more than 6 months of tutorials. In 2023, I built "PGFinder" — a full stack property search platform. The idea was simple. Help people find paying guest accommodations based on location, budget and preferences. The reality of building it? Anything but simple. The frontend was React. The backend was Python. The database had to handle real time search filtering across multiple parameters simultaneously. The first version was slow. Not a little slow. Embarrassingly slow. A search query was taking over 3 seconds to return results. 3 seconds is an eternity for a user. So I went back to the database layer. Rewrote the queries. Added proper indexing. Optimised the filtering logic. The same query dropped to under 400 milliseconds. That moment taught me something no tutorial ever did — Performance problems are almost always data problems in disguise. It's not your React components. It's not your Python logic. It's how you structure and query your data. The second lesson was about scope. I started building every feature I could imagine. Location filters. Budget sliders. Photo galleries. Reviews. Maps integration. I had to stop myself and ask — what does a user actually need on day one? Just the search. Just the results. Just the contact. Ship the core. Add the rest later. That single mindset shift saved weeks of wasted development time. Building real projects teaches you things that no course ever will. What's the biggest lesson a real project taught you? #FullStackDevelopment #ReactJS #Python #ProjectBreakdown #DeveloperLife #Tech2026 #BuildInPublic #NodeJS #WebDevelopment #Coding
To view or add a comment, sign in
-
-
🚀 Day 8 of DSA Practice – Small Problem, Big Learning! Today I worked on a classic sorted array problem that looks simple… but has a powerful optimization behind it 👇 🔍 Problem: Count how many times a number appears in a sorted array 👉 Example: [1,1,2,2,2,2,3] → target = 2 → Output = 4 💭 How I approached it: ✅ Started with a Linear Scan (O(n)) – straightforward and reliable 🚀 Then optimized using Binary Search (O(log n)) → Found the first and last occurrence → Calculated frequency efficiently 🧠 Key Takeaway: Whenever you see a sorted array, think beyond brute force. 👉 Binary Search can turn an average solution into an optimized one. 💻 Code available here: 🔗 https://lnkd.in/g2wdfYzZ 📈 Consistency Check: Day 8 ✅ Learning something new every day and getting closer to stronger problem-solving skills 💪 #DSA #100DaysOfCode #JavaScript #CodingJourney #BinarySearch #LearnInPublic #TechGrowth
To view or add a comment, sign in
-
-
🚀 Mastering Recursion in JavaScript: Flattening Arrays Like a Pro One of the most powerful concepts in programming is recursion — and a great way to understand it is by solving real problems. Here’s a clean and practical example: flattening an array of any depth 👇 💡 What’s happening here? We loop through each element If it's an array → we recursively flatten it If not → we push it directly Finally → we combine everything into a single-level array This pattern is 🔥 because it teaches: Recursive thinking Problem decomposition Clean and scalable logic 📚 I’ve been practicing these patterns consistently, and I’ve compiled more exercises here: 👉 https://lnkd.in/ej4fNeZs If you're learning algorithms or preparing for coding interviews, this repo might help you level up 💪 #JavaScript #Recursion #Algorithms #CodingInterview #WebDevelopment #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 #Day14 of My Learning Journey 💻 Today focused on deepening backend knowledge, problem-solving, frontend practice, and revision. 🔹 Django Continued learning Django by exploring core concepts and understanding how backend logic is structured and executed. 🔹 LeetCode – First Unique Character in a String Normal Approach: For each character, count its frequency by scanning the string. Return the first character with a frequency of 1. Time Complexity: O(n²) Space Complexity: O(1) Optimal Approach: Use a hash map to store character frequencies. Traverse the string again to find the first character with count = 1. Time Complexity: O(n) Space Complexity: O(1) (constant alphabet size) 🔹 React Mini Application – Search-Triggered Fetch Built a React mini app where API data is fetched dynamically based on user search input, focusing on controlled inputs and conditional fetching. 🔹 Node.js Revision Revised core Node.js concepts to strengthen backend fundamentals and improve understanding of server-side logic. 💡 Takeaway Balancing backend learning, frontend practice, and DSA keeps growth steady and structured 🌱 Masai #Django #Python #LeetCode #DSA #ReactJS #NodeJS #Masaiverse #Masai #BackendDevelopment #dailylearning #100DaysOfCode #masai
To view or add a comment, sign in
-
2 months ago I started learning JavaScript from scratch. I come from a Python background so I thought it would feel familiar. It didn't and that's what made it interesting. The biggest surprise was Session 1, learning how V8 engine works. I never thought about what actually happens when a browser runs code. Turns out there's a whole pipeline behind it. JS goes through a Parser, builds an Abstract Syntax Tree, goes through an Interpreter, becomes Bytecode, gets profiled for hot code, and finally becomes machine readable output. The browser understands only JavaScript. Everything else gets converted. That one session changed how I think about code. Arrow functions, anonymous functions, IIFE felt so much cleaner and more expressive than anything I had seen before. Once they clicked I couldn't stop using them. 19 sessions later all the scripts are now on GitHub, organised by session, exactly as I learned them. Not to show off. Just to document the journey for anyone who is learning JavaScript and for myself to look back on. Link in the comments. Special thanks to Naveen Khunteta for the structured and hands on way of teaching this. What surprised you the most when you first started learning a new programming language?
To view or add a comment, sign in
-
🚀 #Day32 of My Learning Journey 💻 Today focused on deepening backend knowledge, problem-solving, frontend practice, and revision. 🔹 Django Continued learning Django by exploring core concepts and understanding how backend logic is structured and executed. 🔹 LeetCode – First Unique Character in a String Normal Approach: For each character, count its frequency by scanning the string. Return the first character with a frequency of 1. Time Complexity: O(n²) Space Complexity: O(1) Optimal Approach: Use a hash map to store character frequencies. Traverse the string again to find the first character with count = 1. Time Complexity: O(n) Space Complexity: O(1) (constant alphabet size) 🔹 React Mini Application – Search-Triggered Fetch Built a React mini app where API data is fetched dynamically based on user search input, focusing on controlled inputs and conditional fetching. 🔹 Node.js Revision Revised core Node.js concepts to strengthen backend fundamentals and improve understanding of server-side logic. 💡 Takeaway Balancing backend learning, frontend practice, and DSA keeps growth steady and structured 🌱 Masai #Django #Python #LeetCode #DSA #ReactJS #NodeJS #masai #dailylearning #100DaysOfCode #FullStackJourney #Masaiverse #Masai
To view or add a comment, sign in
-
🚀 Just published a new article on JavaScript! 📖 Read here: https://lnkd.in/gB863RDV I’ve explained one of the most important yet confusing concepts — the new keyword. In this article, I covered: ✔️ What happens when we use new ✔️ How constructor functions work ✔️ Step-by-step object creation process ✔️ Prototype linking and instance creation If you're learning JavaScript or preparing for interviews, this will help you build a strong foundation 💡 🙏 Special thanks to the amazing mentors and community: Hitesh Choudhary Sir Piyush Garg Sir Akash Kadlag Sir Suraj Kumar Jha Sir Chai Aur Code #JavaScript #WebDevelopment #FullStackDeveloper #Programming #Coding #Developers #Learning #Tech
To view or add a comment, sign in
-
-
𝗔 𝗦𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗮𝗹 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿 𝗮𝗰𝗾𝘂𝗶𝗿𝗶𝗻𝗴 𝗪𝗲𝗯 𝗗𝗲𝘃 𝗦𝗸𝗶𝗹𝗹𝘀. 𝗖𝗵𝗮𝗹𝗹𝗲𝗻𝗴𝗲 𝗗𝗮𝘆 𝟴/𝟵 ✅ - 𝗙𝘂𝗹𝗹 𝗦𝗶𝘁𝗲 𝗕𝘂𝗶𝗹𝗱 🟢 Python → 🟢 HTML & CSS → 🟢 Web page Deployment/PHP → 🔘 JavaScript → 🔘 React → 🔘 React Flow → 🔘 Fast API Today was a full website build — all from scratch using HTML, CSS, and a bit of JavaScript. It's fun knowing the building blocks of the web. Yes, AI can do all of this in a glimpse, but understanding what's actually happening underneath means you can direct it, fix it, and build on top of it properly. Tomorrow is the final day of the HTML & CSS course — then on to the most important part: JavaScript. #WebDevelopment #CSS #HTML #JavaScript #Python #FullStack #StructuralEngineering #BridgeEngineering #DigitalEngineering #Upskilling #ResponsiveDesign
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
Consistency matters!! Without roadmap & plans how consistency is possible?