Some problems look simple — until you try solving them without shortcuts. Day 44 — Daily Engineering Practice Solved: Product of Array Except Self At first, the idea seems straightforward: Multiply all elements except the current one. But there’s a constraint: 👉 No division allowed --- The solution? Use prefix and suffix products: • Prefix → product of elements before index • Suffix → product of elements after index Multiply both → get the result for each position. --- Key Insight: Instead of recomputing everything, reuse previously computed values efficiently. --- Also: • Time → O(n) • Space → optimized to O(1) (excluding output) --- What I’m learning: Many problems aren’t about complexity — they’re about seeing the pattern clearly. --- Day 44. Still building consistency. Let’s stay consistent. 🤝 #DSA #LeetCode #Algorithms #ProblemSolving #LearningInPublic
Solving Product of Array Except Self without Division
More Relevant Posts
-
Was solving a tree problem on a whiteboard today. On the board, the solution felt almost obvious. You can see the nodes, the branches, the flow — everything at once. But the moment you switch to code, it becomes step-by-step again. Traversal. Recursion. Iteration. It made me think… What if we had something like “third dimensional programing”? one program enough to solve problems Not writing instructions line by line, but a system that can see the entire structure at once — nodes, connections, states — from a higher-level view. Like how we look at a tree on a whiteboard and instantly understand the shape. For example, problems like: • Lowest Common Ancestor — you just “see” where paths meet • Number of Islands — components become visually obvious • BFS shortest path — layers are clear instantly • Cycle detection in graphs — loops are visible • Tree height / depth — structure speaks for itself These feel almost trivial when visualized… but take time when written step by step. Would problem solving become faster than traditional DSA? Would we move from “executing logic” to “perceiving structure”? Just a thought — curious how others think about this. #DSA #Algorithms #SystemDesign #Coding #SoftwareEngineering #Backend #ProblemSolving #GraphTheory #Trees #ComputerScience #QuantumComputing #QuantumScience
To view or add a comment, sign in
-
-
💡 “In DSA, the smartest solutions often come from transforming the problem into something you already know.” 🚀 #geekstreak60 — Day 46 Day 46 of the streak! Today’s problem was a perfect example of how problem transformation can turn a tricky question into a familiar one. 📌 Problem Statement Given an array, we can assign + or - before each element and form an expression. Goal: ➡️ Count the number of ways to reach a given target sum 🧠 My Thought Process At first, this looked like a brute-force recursion problem: 👉 Try all combinations of + and - → exponential complexity (2ⁿ) But then came the key transformation: Let: S1 = sum of elements with + S2 = sum of elements with - We know: S1 - S2 = target S1 + S2 = totalSum Solving: 👉 S1 = (totalSum + target) / 2 🛠️ Optimized Approach The problem reduces to: ✅ Count number of subsets with sum = S1 Applied Dynamic Programming (subset sum counting) to efficiently compute the answer. ⚡ Complexity Analysis Time Complexity: O(n × sum) Space Complexity: O(sum) Efficient for given constraints. 💡 Key Learning Transforming a problem is often more powerful than solving it directly. Today strengthened my understanding of: ✅ Problem transformation techniques ✅ Subset sum DP ✅ Counting-based dynamic programming ✅ Optimizing exponential problems Consistency continues strong 💪🔥 #geekstreak60 #npci #DSA #CPP #DynamicProgramming #ProblemSolving #CodingJourney #ContinuousLearning
To view or add a comment, sign in
-
-
💡 “In DSA, sometimes the simplest problems teach the most powerful techniques.” 🚀 #geekstreak60 — Day 49 Day 49 of the streak! Today’s problem looked very simple on the surface — but it reinforced one of the most important patterns in problem-solving: Two Pointers. 📌 Problem Statement Given a binary array (only 0s and 1s), the task was to: ➡️ Rearrange the array in-place ➡️ Move all 0s to the left ➡️ Move all 1s to the right 🧠 My Thought Process At first, I thought of counting the number of 0s and then rebuilding the array. But then I realized: We can solve this in a single pass without extra space. 🛠️ Optimized Approach Used the Two Pointer Technique: left → start of array right → end of array Process: ✅ Move left forward if it’s already 0 ✅ Move right backward if it’s already 1 ✅ Otherwise, swap them This ensures correct placement in one traversal. ⚡ Complexity Analysis Time Complexity: O(n) Space Complexity: O(1) 💡 Key Learning Even the simplest problems can strengthen your core patterns. Today reinforced my understanding of: ✅ Two pointer technique ✅ In-place array manipulation ✅ Writing optimal O(n) solutions ✅ Avoiding unnecessary extra space 🔥 Big Insight of the Day “Optimization isn’t always about complexity — sometimes it’s about eliminating unnecessary work.” 49 days strong 💪🔥 From advanced graphs to simple arrays — consistency is the real game. #geekstreak60 #npci #DSA #CPP #TwoPointers #ProblemSolving #CodingJourney #ContinuousLearning
To view or add a comment, sign in
-
-
🚀 Day 27 of 100 Days LeetCode Challenge Problem: Matrix Similarity After Cyclic Shifts Day 27 brings a neat simulation + modular arithmetic problem 🔥 💡 Key Insight: Shifting happens k times, but instead of simulating k steps: 👉 We can reduce it using modulo Effective shifts = k % n (where n = number of columns) 🔍 Core Approach: 1️⃣ Understand Row Behavior Even rows → shift left Odd rows → shift right 2️⃣ Apply Optimized Shift For each row: Calculate effective shift using modulo Perform one optimized shift instead of k times 3️⃣ Compare with Original Matrix If all rows match → ✅ true Else → ❌ false 💡 Why Modulo Works: After n shifts, row returns to original state → avoids unnecessary computation 🚀 🔥 What I Learned Today: Repeated operations → think modulo optimization Simulation problems can often be simplified Understanding patterns saves time 📈 Challenge Progress: Day 27/100 ✅ Closing in on 30! LeetCode, Matrix, Simulation, Cyclic Shift, Modular Arithmetic, Arrays, DSA Practice, Coding Challenge, Problem Solving #100DaysOfCode #LeetCode #DSA #CodingChallenge #Matrix #Simulation #ModularArithmetic #ProblemSolving #TechJourney #ProgrammerLife #SoftwareDeveloper #CodingLife #LearnToCode #Developers #Consistency #GrowthMindset #InterviewPrep
To view or add a comment, sign in
-
-
Day 88/100 of my #100DaysOfDSA journey Today was a revision-focused day. Instead of learning something new, I went back and strengthened previously covered topics. --- Revised topics: • Strings • Arrays & 2D Matrices • Matrix traversal patterns --- Key learnings: • Most problems become easier with strong fundamentals • Patterns in 2D matrices (row-wise, column-wise, spiral) are very common • String problems often revolve around traversal + frequency counting • Small optimizations in basics can improve overall problem-solving speed --- What I did differently today: Instead of rushing to new topics, I focused on: → Revisiting mistakes → Strengthening weak areas → Improving speed and clarity --- Core understanding: Advanced DSA is built on strong basics. If fundamentals are clear → complex problems feel simpler. --- What I realized: Revision is not going backward — it’s reinforcing the foundation for faster growth. --- Consistency > Complexity. --- #DSA #Arrays #Strings #Matrix #2DMatrix #100DaysOfCode #CodingJourney #LeetCode #CP #Programming #Coding #Tech #Streak #100DaysStreak
To view or add a comment, sign in
-
Day 71 of the 60 Days POTD Challenge Powered By NPCI on GFG. Today’s problem was all about handling collisions step-by-step 👀 Not tricky… but requires careful simulation 💻 🔥 Day 71/60 📌 Today's Problem: Reduce Pairs (Collision Simulation) 💡 Approach: ✔️ Used a stack (vector) to simulate process ✔️ For each element x: 👉 Checked collision with stack top ✔️ Collision happens when: • top > 0 and x < 0 (opposite directions) ✔️ Handled 3 cases: • |top| > |x| → current element destroyed ❌ • |top| < |x| → pop stack, continue checking • |top| == |x| → both destroyed ❌ ✔️ If no collision → push element into stack ✔️ Final stack = remaining elements after all reductions Complexity: ⏱️ Time: O(n) 📦 Space: O(n) 💭 Key Learning: 👉 Stack is powerful for problems involving: • previous elements interaction • collision / elimination patterns 👉 Always simulate carefully with all edge cases 💯 🤔 Let’s Make This Interactive: Array = [5, 10, -5] 👉 What will be the final array after all reductions? (Comment your answer 👇) Consistency Still Going Strong ✔ Stack Concepts Getting Solid 💪 Problem Solving Depth Increasing 📈 #geekstreak60 #npci #tcsnqtwithgfg #geeksforgeeks #DSA #coding #programming #algorithms #datastructures #cpp #interviewprep #problemSolving #softwaredeveloper #tech #learning #consistency #growthmindset #developers #stack
To view or add a comment, sign in
-
-
Day 115: Grinding Through the Hard Problems 📉 Problem 3464: Maximize the Distance Between Points on a Square Today was a tough one. I went up against a "Hard" problem that pushed my current limits. Honestly, I couldn't crack the logic on my own and had to spend time watching tutorials to grasp the optimal approach. The Learning Curve: • Perimeter Mapping: I learned how to "unroll" a square's boundary into a single linear dimension, making it easier to handle distances along the edges. • Binary Search on Answer: The core of the problem relied on searching for the maximum possible minimum distance, a classic but tricky optimization pattern. • Greedy Validation: Implementing a check function to see if K points can maintain a specific distance requires precise pointer management and binary search techniques within the search space. I'm not proud of needing a guide today, but I'm glad I didn't just copy-paste—I took the time to understand the why behind the solution. Growth isn't always a straight line of wins; sometimes it's about failing, learning, and coming back stronger. Day 115 in the books. 🚀 #LeetCode #Cpp #Algorithms #BinarySearch #ProblemSolving #DailyCode
To view or add a comment, sign in
-
Hi LinkedIn Fam, Started learning System Design – Day 6 Moving ahead with Structural + Behavioral Design Patterns. Covered: Bridge, Strategy Bridge Pattern: Use case: When you want to separate abstraction from implementation so both can change independently. Decouples interface and implementation Improves flexibility and scalability Avoids tight coupling Key idea: Separate “what” from “how”. Strategy Pattern: Use case: When multiple algorithms exist and you want to choose one at runtime. Encapsulates different behaviors Makes algorithms interchangeable Removes complex if-else conditions Key idea: Define a family of algorithms and switch between them easily. Quick Summary Bridge → Decouples abstraction and implementation Strategy → Switch algorithms at runtime Learning step by step. Strong fundamentals lead to better system design. #SystemDesign #DesignPatterns #StructuralPatterns #BehavioralPatterns #LearningJourney #Day6 #SoftwareEngineering
To view or add a comment, sign in
-
One of the ways you could get better output through LLMs is asking it to review its own response. I use this often in coding and turns out this is one of “Agentic Design Patterns” and is called “Reflection”. It is as if LLMs give answers out of instinct the first time you ask them , no matter how good your prompt is and then gets into introspective mode when you ask you to review it. #genai #agenticai
To view or add a comment, sign in
-
I'm currently leading a comprehensive image classification research project as collaboration between Guild Code and Guild Code Community, mentoring great minds; the research spans the full #CRISPDM lifecycle, from exploratory data analysis through model deployment. Here's a glimpse into the depth of work involved: 📐 Mathematical Foundations Every design choice is grounded in theory; cross-entropy loss, focal loss for hard example mining, label smoothing regularisation, AdamW with decoupled weight decay, cosine annealing with warm restarts, and stochastic depth. No black boxes!!! 🏗️ 11 Models, Systematically Compared - Linear baseline (logistic regression on raw pixels) - Custom CNN trained from scratch - Classical transfer learning (VGG16, ResNet50, InceptionV3) - Efficient architectures (EfficientNet-B0/B3, MobileNetV3) - Vision Transformer (ViT-Small/16) - Soft voting & weighted ensembles Each model follows a rigorous 2-phase training protocol: frozen backbone → discriminative fine-tuning with differential learning rates. 📊 Evaluation Beyond Accuracy - McNemar's test & paired bootstrap CIs for statistical significance - Per-class ROC curves (One-vs-Rest) - Grad-CAM interpretability, what does the model actually look at? - t-SNE / UMAP embedding visualisation - Expected Calibration Error (ECE) & reliability diagrams - Latency vs accuracy efficiency frontier analysis 🔬 Why This Matters Too many ML research report a single accuracy number with no confidence intervals, no calibration analysis, and no statistical testing. Rigorous evaluation isn't optional, it's what separates research from experimentation. The full pipeline: data integrity auditing → preprocessing with mathematical justification → systematic modelling → Evaluation. Every formula documented. Every decision justified. #DeepLearning #MachineLearning #ComputerVision #TransferLearning #CNN #VisionTransformer #ViT #EfficientNet #ResNet #GradCAM #ModelInterpretability #StatisticalTesting #CRISPDM #PhDResearch #AIResearch #PyTorch #DataScience #MLEngineering #ImageClassification #ModelEvaluation #Calibration #tSNE #EnsembleLearning #ReproducibleResearch #AcademicML #ArtificialIntelligence #GuildCode #GuildCodeCommunity
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