🎯 Day 172 of #200DaysOfCode Today’s challenge was all about finding all pairs in an array whose sum equals a given target number — a classic logic-building problem that strengthens both your thinking pattern and problem-solving flow. 💡 While most developers would jump to use built-in methods or advanced structures, I implemented it manually using nested loops — because fundamentals matter the most. 📘 Concepts reinforced today: • Nested loop logic • Pair combination generation • Conditional validation • Edge case handling (no valid pairs found) 🌍 Real-world use cases: ✅ Matching data pairs (like prices or scores) ✅ Detecting patterns in datasets ✅ Implementing basic algorithmic logic for interviews 🔥 The beauty of coding lies in building clarity — not just functionality. Every problem solved sharpens your analytical edge! #JavaScript #172DaysOfCode #ProblemSolving #LearnInPublic #WebDevelopment #CodingChallenge #LogicBuilding #BackToBasics #DeveloperMindset
Solved pairs problem with nested loops in JavaScript
More Relevant Posts
-
🔽 Day 166 of #200DaysOfCode Today, I continued sharpening my fundamentals by implementing Bubble Sort in descending order — without using JavaScript’s built-in .sort() method. 💡 While sorting might look simple on the surface, it is one of the most essential concepts in programming — powering search algorithms, intelligent ordering systems, real-time data processing, and more. By writing this logic manually, I reinforced: ✅ How comparisons work inside loops ✅ Value swapping and index manipulation ✅ Time complexity analysis (O(n²) for Bubble Sort) ✅ Why optimized sorting algorithms matter in bigger datasets 🌱 Every advanced concept in Data Structures & Algorithms is built on these fundamentals — and revisiting them helps improve clarity, confidence, and coding discipline. 🔁 Progress in programming isn’t linear — it’s iterative. Master the basics, and everything else becomes easier. #JavaScript #166DaysOfCode #BubbleSort #Algorithms #WebDevelopment #DSA #CodingChallenge #ProblemSolving #LearnInPublic #DeveloperMindset
To view or add a comment, sign in
-
-
🔼 Day 165 of #200DaysOfCode Today, I revisited a fundamental concept that plays a major role in data structures and algorithm design — sorting an array in ascending order using Bubble Sort (without built-in sort methods). 💡 Modern JavaScript gives us shortcuts like Array.sort(), but when we build the logic manually, we develop a much deeper understanding of: • Pairwise comparison • Value swapping in arrays • Nested looping structure • Time complexity (Bubble Sort → O(n²)) Sorting isn’t just a beginner concept — it’s the backbone of efficient searching, optimization, and real-world computational logic. 🔁 Going back to basics reminds me that advanced problem-solving ability is built on strong fundamentals, not shortcuts. 🌱 Every step forward in coding is supported by the basics we choose to master — and revisit. #JavaScript #200DaysOfCode #CodingChallenge #Sorting #Algorithms #WebDevelopment #DeveloperMindset #LearnInPublic #DSA #ProblemSolving
To view or add a comment, sign in
-
-
🔥 𝗠𝗮𝗰𝗵𝗶𝗻𝗲 𝗖𝗼𝗱𝗶𝗻𝗴 — 𝗙𝗶𝗹𝗲 𝗦𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗲 𝗣𝗿𝗼𝗯𝗹𝗲𝗺 Got inspired after watching Akshay Saini 🚀’s Machine coding series — and decided to take on a fun machine coding challenge: Building a file explorer from scratch. 𝗣𝗿𝗼𝗯𝗹𝗲𝗺 𝗦𝘁𝗮𝘁𝗲𝗺𝗲𝗻𝘁 👇 ✅ Render a tree-structure from JSON (folders/files with expand-collapse) ✅ Add new files or folders dynamically at any level ✅ Keep everything sorted alphabetically — folders first, then files 𝗧𝗲𝗰𝗵𝗻𝗶𝗾𝘂𝗲𝘀 𝗜 𝘂𝘀𝗲𝗱: 1. Recursive function to render nested structures. 2. React Context API to manage shared states (active folder, add mode, etc). 3. Pure immutable state updates using structured cloning for clean re-renders. 4. Smart sorting logic — folders and files handled separately and merged elegantly. 💻 𝗟𝗶𝘃𝗲 𝗱𝗲𝗺𝗼 : https://lnkd.in/gJapscTm 🔗 𝗚𝗶𝘁𝗛𝘂𝗯 (𝗰𝗼𝗱𝗲): https://lnkd.in/gCnpu39P 🎥 𝗔𝗸𝘀𝗵𝗮𝘆'𝘀 𝗬𝗧 𝘃𝗶𝗱𝗲𝗼: https://lnkd.in/gXch9JKE 𝗗𝗿𝗼𝗽 𝘆𝗼𝘂𝗿 𝘁𝗵𝗼𝘂𝗴𝗵𝘁𝘀 👇 — 𝘄𝗼𝘂𝗹𝗱 𝗹𝗼𝘃𝗲 𝘁𝗼 𝗱𝗶𝘀𝗰𝘂𝘀𝘀 𝗱𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝘁 𝗮𝗽𝗽𝗿𝗼𝗮𝗰𝗵𝗲𝘀! #ReactJS #MachineCoding #FrontendDevelopment #JavaScript #CleanCode #WebDevelopment #SoftwareEngineering #CodingInterview #Learning
To view or add a comment, sign in
-
🔍 Day 171 of #200DaysOfCode Today, I implemented a function to check whether a specific value exists in an array — without using built-in methods like .includes(). This challenge helped strengthen my understanding of: • Array traversal using loops • Conditional comparisons • Manual search logic • Returning Boolean results effectively 🌍 Though simple, this concept plays a big role in real-world applications like: ✅ Searching records in a dataset ✅ Validating user inputs ✅ Checking access permissions ✅ Matching values in dynamic arrays 💡 Every “basic” problem hides a core principle that drives advanced algorithms. Mastering small steps leads to giant leaps in logic building! #JavaScript #171DaysOfCode #ProblemSolving #LearnInPublic #BackToBasics #WebDevelopment #CodingChallenge #DeveloperMindset #LogicBuilding
To view or add a comment, sign in
-
-
🚀 Day 88 of #100DaysOfLeetcode 🧩 Problem: Next Smaller Element You are given an array of integers, and for each element, you need to find the next smaller element to its right. If none exists, return -1. 💡 Example: arr = [2, 3, 1] → Output: [1, 1, -1] Because for 2 → next smaller is 1, for 3 → next smaller is 1, and for 1 → none smaller → -1. 🧠 Brute Force Approach Logic: For every element, traverse the elements to its right and find the first smaller one. Code Complexity: ⏱ Time Complexity: O(n²) – two nested loops 💾 Space Complexity: O(1) – no extra space used ⚙️ Optimal Approach (Using Stack) Logic: We iterate from right to left while maintaining a stack to keep track of potential smaller elements. Pop elements from the stack while the top is greater or equal to the current element. The top of the stack after popping gives the next smaller element. Push the current element into the stack for future comparisons. Code Complexity: ⏱ Time Complexity: O(n) – each element is pushed and popped once 💾 Space Complexity: O(n) – stack used for storing elements 🧮 Key Learnings: Stack-based problems often involve processing from right to left. Understanding Monotonic Stack pattern helps solve many similar problems like “Next Greater Element” and “Stock Span”. Helps in real interview scenarios where time optimization is key. ⚠️ Edge Cases: All elements in increasing order → Output will be all -1s. All elements in decreasing order → Each next element will be the answer for previous one. Single element array → Output should be -1. 💬 Final Thought: Learning the concept of Monotonic Stack not only simplifies the solution but also builds intuition for multiple real-world stack-based interview questions. 🔥 #100DaysOfCode #Leetcode #DSA #Stack #JavaScript #CodingChallenge #ProblemSolving #TechCommunity #LearningNeverStops #ProgrammingJourney #CodeNewbie #FrontendDeveloper #DataStructuresAndAlgorithms
To view or add a comment, sign in
-
-
🧠 Day 20 of #100DaysOfDSA Today I practiced two classic problems from LeetCode — FizzBuzz and Reverse String. 📘 What I learned: These might look like simple problems, but they help sharpen logic building, loops, and condition handling — essential building blocks for bigger challenges. 💻 Problems Solved: 1️⃣ FizzBuzz – A fun way to practice modular arithmetic and condition prioritization. 2️⃣ Reverse String – Implemented using the two-pointer approach for an in-place reversal. 💡 Key Takeaways: FizzBuzz reinforces thinking through branching logic. The two-pointer method is efficient for array and string manipulation. Small problems like these build the foundation for complex algorithms. 🔗 Check out my implementations here: https://lnkd.in/gxs9yaen #100DaysOfCode #DSA #LeetCode #JavaScript #CodingJourney #ProblemSolving #LearningInPublic
To view or add a comment, sign in
-
📘 Today’s Learning: Big O Notation 🔍 Today I explored one of the most important concepts in programming — Big O Notation 🚀 Big O helps us understand how efficient our code is — how fast or slow it runs as the size of input grows. It’s all about analyzing time complexity and space complexity. 💡 What I learned & practiced: Understanding O(1), O(n), O(n²) and more Comparing how different data structures like Array and Set perform Experimenting with forEach, map, and loops to see how operations scale with input size Writing small test cases to visualize performance differences 🧠 Key Takeaway: Big O is not about exact speed — it’s about how your algorithm scales. Optimizing for efficiency is what separates good developers from great ones 💪 #BigONotation #TimeComplexity #CodingJourney #JavaScript #LearningEveryday
To view or add a comment, sign in
-
-
Patterns I hear it repeatedly, "Pick out the patterns." When solving coding problems this definitely rings true. Honestly it rings true in the world of nursing where I was originally from as well. When you sat down at the computer for your nursing license test it did not matter how many questions you practiced and how much of each medical problem you knew. That is not what got me or anyone else through. You have to realize the PATTERN. It was not always what they were asking, but how they were asking it. What details are they purposefully putting in the question or purposefully leaving out. Thinking out the problem, before looking at any answers provided to choose from. Very thankful for other coders who share what they have learned and what worked for them. I hope this post helps someone along their journey like it did me.
75K+ LinkedIn Fam | Brand Partnership | Helping Brands Go Viral Organically, Grow | AI, Tech & Marketing Content | 25+ Brand collabs | Tech Consulting | Engineer | 100M+ Views | Open for Collaborations & Promotions
𝗠𝘆𝘁𝗵: “𝗬𝗼𝘂 𝗻𝗲𝗲𝗱 𝘁𝗼 𝘀𝗼𝗹𝘃𝗲 𝟱𝟬𝟬+ 𝗟𝗲𝗲𝘁𝗖𝗼𝗱𝗲 𝗾𝘂𝗲𝘀𝘁𝗶𝗼𝗻𝘀 𝘁𝗼 𝗰𝗿𝗮𝗰𝗸 𝗙𝗔𝗔𝗡𝗚.” Reality? In interviews, you’ll rarely face more than: 👉 8–10 Array/String Style questions 👉 15–20 Tree/Graph Style questions 👉 20–30 DP Style questions That’s it. You don’t need to grind endlessly. You need to spot patterns. When I was preparing, I made this mistake → grinding question after question, hoping numbers would guarantee success. It didn’t. ❌ Here's what actually works: ☑️ Solve 5–6 core problems per pattern until you can code them blind ☑️ Arrays → two-pointers, sliding window, prefix sums ☑️ Trees → DFS/BFS variations (Level Order, LCA, Number of Islands) ☑️ DP → start with 1D (Climbing Stairs), move to 2D (Unique Paths), then Knapsack Pattern recognition beats problem count every single time. And Leeco made this shift way easier for me - an AI LeetCode guide that makes you focus on patterns, not problem count: https://lnkd.in/gNDrzcGP Instead of letting you hop between random problems, it ensures you actually understand what you're solving. 💯 When I was stuck on 'House Robber,' I couldn't see the pattern. Leeco asked: 'What if robbing the current house means you can't use the previous one?' That one question helped me see the choice at each step. ✅ Stop chasing 500 problems. Start mastering 50 patterns with Leeco. Good luck with your prep! JavaScript Mastery #dsapatterns #leetcode #dsatips #paidpartnership #dsainterviews #DSA #codingmentor #datastructures #programming #coding #programmer #algorithm #java #datastructure #python #javascript #coder #computerscience #algorithms #datastructuresandalgorithms #codinglife #coders #webdevelopment #software #dsa #codingbootcamp #developer #learn #programmers #softwaredeveloper #datascience #technology #with #programminglife #re #programmingmemes #html
To view or add a comment, sign in
-
🔧 Bad Code Today = Technical Debt Tomorrow Yesterday, I dedicated 3 hours to debugging an issue. Surprisingly, the solution boiled down to a simple one-line alteration. The root cause? Code resembling this snippet: let d = [] let u = data.map(x => x.map(y => y * 2)) Contrast that with the refined version: let discounts = [] let userPrices = data.map(item => item.map(price => price * 2)) Same functionality, yet operating in entirely different realms. Key takeaways: 1️⃣ The significance of variable names → d vs discounts conveys distinct narratives. 2️⃣ Simplify complexity → When dealing with nested loops, structure them for enhanced legibility. 3️⃣ Anticipate future laziness → Craft code with the developer (possibly future you 😅) in mind, six months down the line. 4️⃣ Comments are crucial → Elucidate the 'why' behind the code, not just the 'what'. Incorporating these minor practices can significantly reduce your team's debugging time. 💬 What's the most valuable lesson you've learned from encountering "unreadable code"? Share below 👇 #CleanCode #DeveloperLife #CodingTips #NodeJS #MERN #Debugging #BestPractices
To view or add a comment, sign in
-
-
💡 Brute Force vs. Mathematical Logic — Which One Wins? ⚔️ Tried a small coding challenge today: 👉 Find two numbers in an array whose sum equals a target (classic 2-sum problem 😎). code: https://lnkd.in/gtRVzcZY 🧠 Observation: Both give the same result — but the mathematical approach is cleaner, faster, and more efficient 💪 Sometimes, it’s not just about solving the problem… It’s about solving it smartly. 🚀 #JavaScript #CodingFun #LogicBuilding #ProblemSolving #WebDevelopment #LearnToCode #Efficiency #DeveloperLife
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