🚀 #GeekStreak60 Day 46 – Painting The Fence 🎨
DP problem: paint n posts with k colors, max 2 same adjacent
Key idea → track same & diff states
Optimized to O(n) time & O(1) space ⚡
Consistency > motivation 💪
#DSA#Coding#npci#GFG@geeksforgeeks@NPCI_NPCI
🚀 #GeekStreak60 Day 42
Partitions with Given Difference
💡 Trick: Convert to subset sum
target = (sum + diff) // 2
⚡ Count subsets using DP
Consistency wins 🔥
#npci@geeksforgeeks@NPCI_NPCI