Day 33 Backend Dev Journey: Greedy Thinking & Performance Optimization

🚨 This problem didn’t ask for optimization… but understanding possibilities. Day 33 of my Backend Developer Journey — and today was about 👉 maximizing outcome with flexible inputs 🧠 LeetCode Breakthrough Solved today’s Daily Challenge using greedy thinking 💡 What clicked: → Treat _ as flexible moves → Calculate current position → Use _ to maximize distance ⚡ The real trick: 👉 Don’t fix unknowns… 👉 use them to your advantage 🔍 Key Insight 👉 Known moves → fixed contribution 👉 Unknown moves → maximize result ⚡ Final answer = |current position| + number of flexible moves 🔗 My Submission:https://lnkd.in/ghdgkZVV ☕ Spring Boot Learning 🔄 Orphan Removal vs Cascade Delete Today I explored a subtle but powerful concept 👇 👉 Cascade Delete → Deletes child when parent is deleted 👉 Orphan Removal → Deletes child when it is removed from relationship ⚡ Key Difference 💡 Cascade = Parent-based deletion 💡 Orphan = Relationship-based deletion 🚨 N+1 Query Problem One of the most important backend performance issues 👇 👉 Fetch 1 parent → triggers N extra queries for children ⚡ Problem: 👉 Multiple unnecessary DB calls 🔥 Solution 👉 Use fetch join 👉 Use @EntityGraph 👉 Prefer JOIN FETCH in queries 🧠 The Shift 👉 Problems are not always about solving… but maximizing 👉 Backend performance matters as much as correctness 👉 Small concepts → huge real-world impact 📘 Spring Boot Notes: https://lnkd.in/gRgxP7Th 🔗 GitHub Repo (Project):https://lnkd.in/gWb8ZPdv 📈 Day 33 Progress: ✅ Learned greedy thinking approach ✅ Understood orphan removal vs cascade ✅ Discovered N+1 query problem 💬 Have you ever faced N+1 issues in your project? 👇 #100DaysOfCode #BackendDevelopment #SpringBoot #Java #LeetCode #SystemDesign #CodingJourney

  • text

To view or add a comment, sign in

Explore content categories