Day 19 of 100 Days of Code: Logic Over Lines of Code

𝐃𝐚𝐲 𝟏𝟗/𝟏𝟎𝟎 𝐨𝐟 𝐃𝐒𝐀 ✨ #100daysofCode Day 19 was all about seeing patterns clearly before coding. I worked on two different problems, but both taught the same lesson: logic > lines of code. 🔹 Problem 1: Pascal’s Triangle What I learned: Every row starts and ends with 1 Middle elements are formed by adding the two elements just above Pattern clarity makes implementation straightforward Key insight: Once the pattern is understood, the code almost writes itself. 🔹 Problem 2: Line Visibility (Who can see whom) What I learned: A person can see only shorter people Visibility stops at the first person of equal or greater height Stack logic should be used to find blockers, not blindly count Key insight: This problem taught me the importance of thinking in terms of constraints, not just data structures. 🔹 Common takeaway from both problems Don’t jump into coding Understand rules, blockers, and boundaries One clear insight can fix multiple wrong approaches Onwards to Day 20 🚀 #100DaysOfCode #Day19 #DSA #PascalTriangle #Stack #ProblemSolving #LearningByDoing #Consistency

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories