🚨 I didn’t check every pair… and still got the maximum distance. Day 29 of my Backend Developer Journey — and today was about 👉 thinking smart instead of thinking more 🧠 LeetCode Breakthrough Solved “Two Farthest Houses with Different Colors” 💡 What clicked: → No need to compare all pairs → Just compare with first and last house → Expand from both ends ⚡ The real trick: 👉 The farthest distance will always involve either the first or the last element 🔍 Key Insight Instead of brute force (O(n²)): 👉 Use two pointers 👉 Compare edges only ⚡ Optimized to O(n) with simple logic 🔗 My Submission:https://lnkd.in/gE4cBmuV ☕ Spring Boot Learning 🔁 JPA Repository Revision Today I revisited the core of Spring Data JPA 👇 👉 JpaRepository simplifies database operations 👉 No need to write boilerplate SQL 👉 Built-in methods like: → save() → findById() → findAll() → delete() ⚡ Why this matters 💡 Strong fundamentals > New concepts 👉 Writing less code 👉 Getting more done 👉 Cleaner backend design 🧠 The Shift 👉 Optimization is about observing patterns 👉 Revising basics makes concepts stronger 👉 Backend mastery = consistency + clarity 📘 Spring Boot Notes:https://lnkd.in/gpWQvkyK 📈 Day 29 Progress: ✅ Improved problem-solving efficiency ✅ Strengthened JPA fundamentals ✅ Practicing consistency daily 💬 Have you ever solved a problem faster by doing less work? 😄 #100DaysOfCode #BackendDevelopment #SpringBoot #Java #LeetCode #CodingJourney
Two Farthest Houses with Different Colors LeetCode Breakthrough
More Relevant Posts
-
🚨 I thought this was just grouping… but prefix sums changed everything. Day 32 of my Backend Developer Journey — and today was about 👉 turning brute force into math 🧠 LeetCode Breakthrough Solved today’s Daily Challenge using HashMap + Prefix Sum logic 💡 What clicked: → Group indices of same values → Use prefix sums to calculate distances efficiently → Avoid recalculating distances again and again ⚡ The real trick: 👉 Don’t compute distances individually 👉 Precompute and reuse calculations 🔍 Key Insight Instead of O(n²): 👉 Split into left + right contribution 👉 Use running sums ⚡ Optimized to O(n) 🔗 My Submission: https://lnkd.in/g9Dar9cq ☕ Spring Boot Learning 🔄 Cascading in JPA (Game Changer for Projects) Working on my Hospital Management System, I explored cascading 👇 👉 CascadeType.PERSIST 👉 CascadeType.MERGE 👉 CascadeType.REMOVE 👉 CascadeType.ALL ⚡ Why this matters 💡 Instead of manually saving related entities: 👉 Save parent → child automatically saved 👉 Delete parent → child automatically handled 🔥 Real Example 👉 Saving Patient → Insurance also gets saved 👉 Deleting Patient → related records handled automatically 🧠 The Shift 👉 Optimization = math + observation 👉 Backend = relationships + lifecycle management 👉 Projects teach more than theory ever will 📘 Spring Boot Notes: https://lnkd.in/gpWQvkyK 🔗 GitHub Repo https://lnkd.in/gWb8ZPdv 📈 Day 32 Progress: ✅ Learned prefix sum optimization ✅ Understood cascading deeply ✅ Improved real-world backend thinking 💬 Do you prefer solving problems using logic or math-based optimization? 👇 #100DaysOfCode #BackendDevelopment #SpringBoot #Java #LeetCode #CodingJourney #SystemDesign
To view or add a comment, sign in
-
-
🚨 I stopped loading all data at once today… and my API got smarter. Day 24 of my Backend Journey — and this is where things started feeling real-world 👇 🧠 LeetCode Learning Solved LeetCode 2515. Shortest Distance to Target String in a Circular Array 💡 What clicked: → Circular traversal thinking → Checking both directions (forward & backward) → No extra space needed ⚡ Smart iteration > complicated logic 🔗 My Submission:https://lnkd.in/gja7CGPS ☕ Spring Boot Realization Today I learned Pagination using Spring Data JPA 👉 Page = chunk of data 👉 Pageable = pagination config 👉 PageRequest = implementation Instead of loading everything: ✔ Fetch only what’s needed ✔ Add sorting + pagination ✔ Build scalable APIs 🧠 The Shift 👉 Backend is not just about working code 👉 It’s about efficient data handling Small changes like pagination = big impact in real apps 📘 Spring Boot Notes: https://lnkd.in/gRgxP7Th 📈 Day 24 Progress: ✅ Better API design understanding ✅ Improved problem-solving approach ✅ Thinking like a backend engineer 💬 Do you prefer writing optimized code first, or refining later? 👇 Let’s discuss #100DaysOfCode #BackendDevelopment #SpringBoot #Java #LeetCode #CodingJourney
To view or add a comment, sign in
-
-
🚨 I solved this problem… but the real learning was in how I stored data. Day 26 of my Backend Developer Journey — and today was all about thinking ahead while iterating 👇 🧠 LeetCode Breakthrough Solved LeetCode 3761. Minimum Absolute Distance Between Mirror Pairs 💡 What clicked: → Reverse the number to find its mirror → Store reversed values in HashMap → Check distance while iterating ⚡ The key trick: Instead of searching later… 👉 Prepare data in advance while traversing 🔍 Key Insight 👉 Store future-use data (reversed numbers) 👉 Avoid nested loops 👉 Reduce time complexity to O(n) 🔗 My Submission: https://lnkd.in/gUZ5QUKc ☕ Spring Boot Learning 🔄 Hibernate Entity Lifecycle Deep Dive Today I didn’t just learn states… I understood how Hibernate actually behaves internally 👉 Transient – Only in heap memory 👉 Persistent – Connected & tracked by Hibernate 👉 Detached – Exists but not tracked 👉 Removed – Marked for deletion ⚡ Real Game Changer 💡 Persistence Context (First-Level Cache) 👉 Same entity = same reference 👉 Avoids repeated DB calls 👉 Managed automatically using @Transactional 🔥 Powerful Concept 👉 Updating entity WITHOUT calling save() still works Why? Because Hibernate tracks changes in Persistent State ⚡ This is called: Dirty Checking (not Dirty Read — common mistake 👀) 🧠 The Shift 👉 Efficient coding = smart data preparation 👉 Hibernate is not magic — it’s predictable when understood 👉 Backend = Data + Lifecycle + Optimization 📘 Spring Boot Notes: https://lnkd.in/gRgxP7Th 📈 Day 26 Progress: ✅ Improved hashmap intuition ✅ Understood Hibernate internals deeply ✅ Learned real-world DB optimization concept 💬 Did you know Hibernate updates data even without calling save()? 😄 #100DaysOfCode #BackendDevelopment #SpringBoot #Java #LeetCode #CodingJourney
To view or add a comment, sign in
-
-
🚨 I almost overcomplicated this problem… but pattern recognition saved me. Day 25 of my Backend Developer Journey — and today was all about thinking in cycles 🔁 🧠 LeetCode Breakthrough Solved LeetCode 3488. Closest Equal Element Queries 💡 What clicked: → Group indices using HashMap → Treat indices as circular (important!) → Compare nearest left & right occurrences ⚡ The real trick: Not linear thinking… but circular distance calculation 🔍 Key Insight Instead of checking all elements: 👉 Preprocess positions 👉 Use modulo to simulate circular array 👉 Reduce time complexity significantly 🔗 My Submission: https://lnkd.in/gKBBY7ds ☕ Spring Boot Learning 🔄 Hibernate Entity Lifecycle Today I learned how Hibernate manages objects internally: 👉 Transient – Object created, not in DB 👉 Persistent – Connected to DB (tracked by Hibernate) 👉 Detached – Exists but not tracked 👉 Removed – Marked for deletion 💡 Why this matters: Understanding lifecycle = avoiding unexpected DB behavior 🧠 The Shift 👉 Problems are not always linear 👉 Sometimes the data structure defines the solution 👉 Backend isn’t just coding — it’s understanding system behavior 📘 Spring Boot Notes: https://lnkd.in/gRgxP7Th 📈 Day 25 Progress: ✅ Stronger problem-solving ✅ Better understanding of Hibernate internals ✅ Thinking beyond brute force 💬 Have you ever solved a problem only after changing the way you looked at it? #100DaysOfCode #BackendDevelopment #SpringBoot #Java #LeetCode #CodingJourney
To view or add a comment, sign in
-
-
Building for Scale: Leveling up the "Vela Route" Backend 🛠️📦 It’s been a week of deep dives into the "Spring Way" of doing things. I’ve just wrapped up two major features for my logistics project, Vela Route, that take it from a simple prototype to a more robust, enterprise-ready API. 🚀 Dynamic Search with JPA Specifications: > Instead of writing static queries, I implemented a modular search system. Using the Criteria API, I built "LEGO-like" specifications that allow the API to filter by status and destination dynamically. This ensures the database handles the heavy lifting while keeping the code clean. 🛡️ Global Exception Handling: > I moved away from messy try-catch blocks and implemented a Global Exception Advisor. By using @ControllerAdvice, the app now has a centralized "security guard" that catches errors and returns standardized, professional JSON responses. Next up: Optimizing tracking number lookups with advanced data structures. #Java #SpringBoot #Backend #SoftwareEngineering #VelaRoute #LearningInPublic #PostgreSQL #Docker
To view or add a comment, sign in
-
#SpringUnpackedSeries - 03 Continuing from: https://lnkd.in/gJ4Wg6XN === HOW SPRING BOOT + JPA SIMPLIFY YOUR DATA LAYER? === Ever wonder how Spring Boot manages to connect to a database with almost zero manual setup? It’s all about the "Autopilot" mode! When you combine Spring Boot with JPA (Java Persistence API), the framework takes over the repetitive, "boring" parts of coding, allowing you to focus on building features rather than plumbing. --- The 3-Step Magic Trick --- • Step 1: The Input You provide the basics: a few dependencies in your build.gradle, simple properties, and your @Entity classes. That’s it! • Step 2: The Autopilot Spring Boot kicks in to scan your project. It finds your database drivers, initializes Hibernate, and automatically sets up the EntityManagerFactory. • Step 3: The Result The framework builds the "heavy" machinery. It generates SQL, manages transactions, and handles connection pooling without you writing a single line of JDBC code. --- Why This Matters? --- • Speed: Go from an empty project to a working database layer in minutes. • Clean Code: No more messy boilerplate or manual SQL management. • Efficiency: Let the framework handle complex tasks like Transaction Management and Data Access automatically. #SpringUnpacked #SpringBoot #Java #JPA #Hibernate #SoftwareDevelopment #CodingLife #BackendDevelopment #ProgrammingTips #TechCommunity #WebDevelopment
To view or add a comment, sign in
-
-
🚨 This problem looked too simple… and that’s exactly why it was tricky. Day 27 of my Backend Developer Journey — and today reminded me: 👉 Simple problems test clarity, not complexity. 🧠 LeetCode Insight Solved today’s Daily Challenge 💡 What clicked: → Reverse the number → Compute absolute difference → Keep logic minimal ⚡ The takeaway: 👉 No extra data structures 👉 No overthinking 👉 Just clean execution 🔍 Key Insight 👉 Sometimes the problem is already optimal 👉 Your job is to not ruin it with over-engineering 🔗 My Submission:https://lnkd.in/gSP92U_8 ☕ Spring Boot Learning 🔗 JPA Relationships (Game Changer for Backend Design) Today I explored how entities connect with each other in real-world systems 👇 👉 @OneToOne – One entity ↔ One entity 👉 @OneToMany – One → Multiple 👉 @ManyToOne – Multiple → One 👉 @ManyToMany – Many ↔ Many ⚡ Why this matters 💡 Backend is not just APIs… It’s about how data is connected internally 👉 Proper relationships = cleaner DB design 👉 Better performance & maintainability 🧠 The Shift 👉 Not every day is about hard problems 👉 Some days are about discipline & clarity 👉 Strong fundamentals = long-term consistency 📘 Spring Boot Notes: https://lnkd.in/gpWQvkyK 📈 Day 27 Progress: ✅ Improved clarity in problem-solving ✅ Learned core DB relationship mapping ✅ Strengthened backend fundamentals 💬 Do you also overthink simple problems sometimes? 😄 #100DaysOfCode #BackendDevelopment #SpringBoot #Java #LeetCode #CodingJourney
To view or add a comment, sign in
-
-
🚨 I thought this was a simple array problem… until binary search showed up. Day 28 of my Backend Developer Journey — and today was about 👉 combining logic + optimization 🧠 LeetCode Breakthrough Solved a problem using Binary Search + Reverse Thinking 💡 What clicked: → Reverse one array to simplify comparison → Apply upper_bound (binary search) → Maximize distance efficiently ⚡ The real trick: 👉 Don’t solve the problem as it is… 👉 Transform it into something easier 🔍 Key Insight Instead of brute force: 👉 Preprocess data (reverse array) 👉 Use binary search to reduce complexity ⚡ From O(n²) → O(n log n) 🔗 My Submission: https://lnkd.in/gF3_5BrW ☕ Spring Boot Learning 🐘 PostgreSQL + DBeaver Setup Today I stepped into real backend setup 👇 👉 Installed PostgreSQL locally 👉 Connected database using DBeaver 👉 Explored tables, queries, and DB structure ⚡ Why this matters 💡 Backend isn’t complete without DB understanding 👉 Writing code is one part 👉 Managing real data is the real game 🔥 Big Win Today ✅ Successfully connected Spring Boot to PostgreSQL ✅ Understood how applications talk to databases 🧠 The Shift 👉 Optimization comes from thinking differently 👉 Tools like DB clients make dev life easier 👉 Backend = Code + Database + Efficiency 📈 Day 28 Progress: ✅ Learned binary search application deeply ✅ Set up real database environment ✅ Took one step closer to production-level backend 💬 When did you first realize backend is more than just writing APIs? 👇 #100DaysOfCode #BackendDevelopment #SpringBoot #Java #PostgreSQL #LeetCode #CodingJourney
To view or add a comment, sign in
-
-
Today, I delved deeper into Spring Data JPA and its role in streamlining backend development for real-world applications. What I explored: - Mapping Java classes to database tables using @Entity and @Table - Handling primary keys with @Id and @GeneratedValue - Building the data access layer using JpaRepository - Writing custom queries with @Query (JPQL) - Understanding the differences between save(), findById(), findAll(), and delete() Advanced Insights: - How Spring Boot abstracts Hibernate complexity - The importance of proper entity relationships (OneToMany, ManyToOne) - Basic ideas of Lazy vs Eager fetching - Clean separation of layers: Controller → Service → Repository Hands-on Implementation: I built a Student Management REST API featuring: - Layered architecture - CRUD endpoints - Database integration using MySQL - API testing with Postman Learning Spring Boot extends beyond coding APIs; it's about designing scalable and maintainable backend systems. Next focus: Exception Handling & Validation in REST APIs.
To view or add a comment, sign in
-
-
Day 26. I stopped using @Data in my JPA entities. Not because it doesn't work. Because it was breaking things I didn’t understand. I used to write this: // ❌ Looks clean — hides real problems @Data @Entity public class User { @Id private Long id; @OneToMany(mappedBy = "user") private List<Order> orders; } Looks clean. Less code. Everything auto-generated. Until it didn’t. Here’s what actually happens: → toString() triggers lazy loading → Infinite recursion in bidirectional relationships → Unexpected database queries → Hard-to-debug logs That’s when it clicked. @Data is not made for entities. It generates: → equals() → hashCode() → toString() And those methods don’t play well with JPA proxies and relationships. So I changed it. (see implementation below 👇) What I learned: → Lombok is powerful — but not always safe → Entities are not simple POJOs → Generated methods can silently break your system The hard truth: → @Data works in tutorials → It fails in real systems → Most developers don’t notice until production Writing less code is easy. Writing safe code is what makes you a backend developer. Are you still using @Data in entities? 👇 #SpringBoot #Java #Hibernate #BackendDevelopment #CleanCode #JavaDeveloper
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