Swayam Kumar’s Post

📅 Day 50 — 100 Days of Coding Challenge 🧠 Problem Solved: Perfect Squares (LeetCode 279) Today’s problem focused on finding the minimum number of perfect square numbers whose sum equals a given number n. 🔍 Problem Summary We are given an integer n and need to: 1️⃣ Use only perfect squares (1, 4, 9, 16, …) 2️⃣ Select the minimum count of such squares 3️⃣ Return the least number of squares whose sum is n ⚙️ Approach Used (Recursive / Brute Force) 1️⃣ Try all perfect squares ≤ n 2️⃣ Subtract the chosen square from n 3️⃣ Recursively solve the remaining value 4️⃣ Take the minimum count among all possibilities 💡 Key Learnings 1️⃣ This is a classic DP optimization problem 2️⃣ Brute force recursion works but causes overlapping subproblems 3️⃣ Memoization / DP can significantly reduce time complexity Day 50 completed — halfway through the challenge 💪🔥 #100DaysOfCode #LeetCode #DP #Recursion #ProblemSolving #DeveloperJourney

  • text

To view or add a comment, sign in

Explore content categories