🚀 #100DaysOfCode – Day 17 Consistency is turning into confidence. Showing up daily 🔥 ✅ What I accomplished today: 🧠 LeetCode Daily Challenge – XOR After Queries 📌 Problem Overview: You are given an array and a list of queries. Each query contains: left, right → range k → step increment value → multiplier 👉 For each query: ✔ Update elements from left to right with step k ✔ Multiply each selected element by value Finally, compute the XOR of the entire array 💡 My Approach (Simulation): 🔹 Iterated through each query 🔹 For every query: ✔ Started from left ✔ Jumped with step k until right ✔ Applied multiplication with modulo (10^9 + 7) 🔹 After processing all queries: ✔ Calculated final XOR of array ⚡ Time Complexity: 👉 O(Q * (N / K)) in worst case ⚡ Space Complexity: 👉 O(1) 🧩 Key Insights: ✔ Step-based traversal reduces unnecessary operations ✔ Careful handling of large numbers using modulo ✔ XOR aggregation at the end is straightforward but important ✔ Simulation works, but optimization scope exists (future improvement 🚀) 🔗 LeetCode Submission Link: https://lnkd.in/gZKCZf87 ☕ Spring Boot Learning – Lambda & Stream API Today I explored one of the most powerful features in modern Java 💡 📌 Key Concepts Covered: ✔ Introduction to Lambda Expressions ✔ Writing concise and readable functional code ✔ Using Stream API for data processing ✔ Performing operations like: filter() map() forEach() collect() ✔ Converting collections into streams for clean transformations 🌍 Why This Matters: ✔ Reduces boilerplate code ✔ Improves readability and maintainability ✔ Encourages functional programming style ✔ Makes data processing more expressive and efficient 🧠 Big Learning: Writing less code doesn’t mean doing less— it means writing smarter, cleaner, and more expressive code. 🔥 Learning Streak: Day 17/100 Discipline today → Results tomorrow 🚀 #100DaysOfCode #Java #SpringBoot #BackendDevelopment #LeetCode #DSA #ProblemSolving #CodingJourney #SoftwareDevelopment #LearningInPublic #Developers #Consistency #BuildInPublic
100 Days of Code - Day 17: LeetCode XOR After Queries and Spring Boot Lambda & Stream API
More Relevant Posts
-
🚀 Day 74 — Slow & Fast Pointer (Cycle Detection in Linked Lists) Continuing the slow‑fast pointer pattern — today I solved the two foundational problems that every DSA learner encounters. No guilt about past breaks, just consistent action. 📌 Problems Solved Today: - LeetCode 141 – Linked List Cycle - LeetCode 142 – Linked List Cycle II 🧠 Key Learnings: 1️⃣ Detecting a Cycle (LeetCode 141) - Initialize `slow` and `fast` at `head`. - `slow` moves 1 step, `fast` moves 2 steps. - If they meet → cycle exists. - If `fast` reaches `null` → no cycle. - Edge case: empty list or single node → return false immediately. 2️⃣ Finding the Cycle Start (LeetCode 142) - First detect cycle using same two pointers. - Once they meet, reset `slow` to `head`. - Move both pointers 1 step each until they meet again. - The meeting point is the start of the cycle. 3️⃣ The Math Behind It (Why this works) Let distance from head to cycle start = X, cycle start to meeting point = Y, meeting point back to cycle start = Z. - Slow travels: `X + Y` - Fast travels: `X + Y + Z + Y` (because it lapped the cycle) - Fast speed = 2 × Slow speed → `2(X + Y) = X + 2Y + Z` → simplifies to `X = Z`. - So resetting slow to head and moving both 1 step makes them meet exactly at cycle start. 💡 Takeaway: These two problems are the gateway to understanding cycle‑related linked list problems. Master this pattern, and you unlock ~40% of linked list interview questions. No looking back — just solving, learning, and moving forward. #DSA #SlowFastPointer #FloydCycleDetection #LinkedList #LeetCode #CodingJourney #Revision #Java #ProblemSolving #Consistency #GrowthMindset #TechCommunity #LearningInPublic
To view or add a comment, sign in
-
🚀 #100DaysOfCode – Day 14 Consistency is turning into discipline. Small steps, every day 💯 ✅ What I accomplished today: 🧠 LeetCode Daily Challenge – Judge Route Circle 📌 Problem Overview: Given a string of moves consisting of U, D, L, R, determine: The robot starts at origin (0,0) Each move changes its position Goal → Check if it returns back to origin 💡 My Approach (Counting Logic): 🔹 Counted frequency of each move 🔹 Compared: ✔ Up vs Down ✔ Left vs Right 🔹 If both are equal → robot returns to origin ⚡ Time Complexity: O(n) ⚡ Space Complexity: O(1) 🧩 Key Insight: This problem helped me understand: ✔ How simple counting can replace simulation ✔ Importance of balance conditions ✔ Writing clean and optimized logic ✔ Avoiding unnecessary computations 🔗 LeetCode Submission Link: https://lnkd.in/gvBucvjB ☕ Spring Boot Learning – Exception Handling 🔹 Today I learned how to handle errors effectively in Spring Boot 📌 Key Concepts Covered: ✔ Using @ExceptionHandler for handling specific exceptions ✔ Handling scenarios like Employee Not Found gracefully ✔ Returning proper HTTP status codes (404, etc.) ✔ Understanding how Optional can throw exceptions 🌍 Global Exception Handling: ✔ Learned @RestControllerAdvice for centralized handling ✔ Created a global exception layer ✔ Kept controllers clean and focused ✔ Explored validation annotations like @AssertTrue, @AssertFalse 🧠 Big Learning: A good backend is not just about success responses— it’s about how well you handle failures and edge cases. 📝 Spring Boot Notes: https://lnkd.in/gakX9V-X 🔥 Learning Streak: Day 14/100 Discipline > Motivation. Let’s keep building 🚀 #100DaysOfCode #Java #SpringBoot #BackendDevelopment #LeetCode #DSA #ProblemSolving #CodingJourney #SoftwareDevelopment #LearningInPublic #Developers #Consistency #BuildInPublic
To view or add a comment, sign in
-
-
🚀 Day 10: Classes & Objects – The Core of Object-Oriented Programming 💎🏗️ Today marks a significant step in my Java journey. I moved beyond writing simple logic and started understanding how to represent real-world entities in code using Classes and Objects. Here’s how I structured my learning: 🔹 1. Class – The Blueprint 📋 A class is a logical structure—a blueprint that defines what an object will look like. It contains: • Properties (State): Variables like name, age, etc. • Behaviors (Actions): Methods that define functionality 👉 Think of it as an architect’s design—you can’t live in it, but it guides construction. 🔹 2. Object – The Real Entity 🏠 An object is an instance of a class. It exists in memory and represents a real-world entity. Created using the new keyword: Car myCar = new Car(); 👉 If the class is the design, the object is the actual building. 🔹 3. Class–Object Relationship 🔗 • A class is defined once • Multiple objects can be created from it • Each object holds its own unique data 💡 Key Takeaway: Programming is not just about writing instructions—it’s about modeling the real world digitally using structured and reusable designs. I’m starting to see how powerful Object-Oriented Programming is in building scalable and maintainable applications. This feels like the foundation for becoming a strong backend developer. 💻 #JavaFullStack #OOP #ObjectOrientedProgramming #JavaDeveloper #CodingJourney #Day10 #BackendDev2026
To view or add a comment, sign in
-
LinkedIn Draft – Merge Two Sorted Linked Lists | Day 13 #DailyLeetcode - Day 13 🖥 Today’s problem felt less like coding… and more like organizing two already sorted things into one. LeetCode Day 13 was about merging two sorted linked lists 🔗 The problem 🎯 List 1: 1 → 3 → 5 List 2: 2 → 4 → 6 Merge them into a single sorted list: 1 → 2 → 3 → 4 → 5 → 6 What clicked for me 💡 Instead of thinking in terms of code, I imagined two queues… And at every step, I just asked: 👉 “Which one is smaller right now?” Pick that. Move forward. Repeat. The approach ⚡ Use a dummy node to simplify things Use a pointer (curr) to build the new list Compare values from both lists Attach the smaller one Move that list forward The intuition 🧠 You’re not creating anything new… you’re just relinking existing nodes in order Step by step, the final list builds itself 🔄 Why I liked this problem No complex logic. No tricks. Just: clarity consistency and small correct steps Complexity ⏱️ Time → O(n + m) Space → O(1) Reflection ✨ Sometimes, problem-solving isn’t about doing something advanced… It’s about asking the right simple question at each step: 👉 “What’s the smallest thing I can do right now?” #LeetCode #DailyCoding #LinkedList #MergeTwoSortedLists #DSA #Java #ProblemSolving #CodingJourney #100DaysOfCode #TechLearning #Algorithms #DataStructures #CodingLife
To view or add a comment, sign in
-
-
LinkedIn Draft – Find Start of Cycle in Linked List | Day 11 #DailyLeetcode - Day 11 🖥 Some loops are easy to detect… but finding where they begin? That’s where it gets interesting. 🔍 LeetCode Day 11 was a perfect continuation of cycle detection. The problem 🎯 Given a linked list with a cycle, find the node where the cycle starts. The idea 💡 We already know how to detect a cycle using: 🐢 Slow pointer 🐇 Fast pointer They eventually meet inside the loop. But the real question is: 👉 How do we find the exact starting node? The breakthrough moment ✨ Once slow and fast meet: ➡️ Move one pointer back to head ➡️ Keep the other at the meeting point ➡️ Now move both one step at a time 🎯 The point where they meet again = start of cycle Why this works 🧠 It’s not magic… it’s math hidden in movement. The distance from: head → cycle start meeting point → cycle start …turns out to be the same. So both pointers naturally meet at the start of the loop 🔁 First meeting happens inside loop Second meeting gives the entry point 🎯 Why this stands out ⚡ No extra memory 🧠 Builds on previous concept Feels like unlocking a deeper layer of logic Complexity ⏱️ Time → O(n) Space → O(1) Reflection ✨ Some problems don’t just test your coding… they test how deeply you understand the pattern. This one felt like going from “knowing” → to truly “understanding”. 😌 #LeetCode #DailyCoding #LinkedList #StartOfLinkedList #DSA #Java #ProblemSolving #CodingJourney #100DaysOfCode #TechLearning #Algorithms #DataStructures #CodingLife
To view or add a comment, sign in
-
-
🚀 #100DaysOfCode – Day 12 | Backend Journey Continues 💻🔥 Consistency is starting to feel powerful now. Day 12 done ✅ 🧠 LeetCode Daily Challenge 📌 Problem: Maximum Walls Destroyed by Robots 💡 Approach & Learnings: Today’s problem was a mix of Sorting + Binary Search + Dynamic Programming, which made it super interesting. 🔹 Sorted robots and walls to process efficiently 🔹 Used Binary Search to quickly count walls in a given range 🔹 Applied Dynamic Programming to maximize total walls destroyed 👉 The key challenge was handling overlapping ranges between robots and deciding the optimal strategy to avoid double counting. This problem really tested how well I can combine multiple concepts into one optimized solution. Submission Link: https://lnkd.in/gp99D5sS 🌱 Spring Boot Learning Today I focused on some very important backend concepts: 🔹 PUT vs PATCH Mapping 👉 PUT Mapping Used when updating the entire object Missing fields → become NULL Best for full replacement 👉 PATCH Mapping Used for partial updates Only updates required fields Avoids unnecessary null values 🔹 ReflectionUtils in PATCH Learned how to use Reflection to dynamically update fields inside an entity. 💡 This helps in: Updating fields without writing multiple setters Making PATCH APIs more flexible Writing cleaner and scalable backend code 🔹 ResponseEntity Understood how to structure API responses properly: ✅ Control HTTP status codes ✅ Customize response body ✅ Improve API clarity and standards 📈 Key Takeaways ✔️ Combining multiple DSA concepts is key for optimization ✔️ PATCH is essential for real-world API design ✔️ Reflection adds flexibility to backend logic ✔️ Clean API responses improve overall system design NotesLink: https://lnkd.in/gNZWz96m 🔥 Day 12 done. Still consistent. Still improving. #BackendDevelopment #SpringBoot #Java #LeetCode #100DaysOfCode #CodingJourney
To view or add a comment, sign in
-
-
🔥 Day 31/100 – DSA Problem Solving 📌 Problem: 412. Fizz Buzz (LeetCode) Today’s problem looks simple, but it really tests your logic building and attention to detail. 💡 My Approach: I used a loop from 1 to n For each number: If divisible by both 3 & 5 → "FizzBuzz" If divisible by 3 → "Fizz" If divisible by 5 → "Buzz" Otherwise → convert number to string 🧠 What I Learned Today: ✅ Importance of using the correct variable inside loops ✅ Order of conditions matters (3 & 5 first) ✅ Writing clean and readable logic ✅ Even easy problems can teach debugging skills 🚀 Key Takeaway: Don’t underestimate easy problems — they help build strong fundamentals and improve problem-solving thinking. 💻 Code Concept: Used simple loop + conditional statements + list to store results. #Day31 #100DaysOfCode #DSA #LeetCode #Java #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
🚀 LeetCode Biweekly Contest 180 — My Experience ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔥 Solved 3 Problems Today ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🟢 Problem 1: Traffic Signal Logic Very straightforward problem. 👉 Just needed to check conditions on timer: 0 → Green 30 → Orange 30 < timer ≤ 90 → Red Else → Invalid 💡 No heavy logic — purely condition-based problem. 🟡 Problem 2: Count Digit Occurrences Given an array and a digit (0–9), we need to count how many times that digit appears across all numbers. 👉 Approach: Traverse each number Extract digits using % 10 Compare with given digit Maintain count 💡 Simple but tests your number handling + basics clarity 🔴 Problem 3: Minimum Operations to Make Alternating Prime (Medium) This was the most interesting one 🔥 👉 Requirement: Even index → Prime number Odd index → Non-prime number Operation → Increment by 1 🧠 My Approach: ✔️ For even index: If not prime → find nearest next prime Add difference to operations ✔️ For odd index: If prime → find nearest non-prime Add difference to operations ⚡ Key Learnings: ✅ Prime number handling is very important ✅ Edge cases (1, 2, small numbers) matter a lot ✅ Always think in terms of minimum operations ✅ Medium problems are mostly about pattern + clarity, not complexity 📈 Final Takeaway: Not every contest is about solving all problems, it’s about improving your thinking speed & accuracy. Today: ✔️ Strengthened fundamentals ✔️ Practiced implementation ✔️ Learned optimization mindset 💬 How many problems did you solve in this contest? Let’s discuss approaches 👇 #LeetCode #DSA #Coding #ProblemSolving #Java #Consistency
To view or add a comment, sign in
-
Day 24 of #100DaysOfCode I stared at this problem for 40 minutes trying every possible target value. Then one insight — borrowed from basic statistics — made it click instantly. 🧩 The Problem: Minimum Operations to Make a Uni-Value Grid (LeetCode 2033 — Medium) Given a 2D grid and a fixed step value x, transform every element to the same value using the minimum number of add/subtract operations. My first instinct? Try every possible target. Loop through everything. Classic overthinking. 😅 💡 The Key Insight — Why the Median? The median minimizes the sum of absolute differences. This is a well-known statistics fact — and it maps perfectly to this problem. Instead of brute-forcing every target, the strategy is simple: → Flatten the 2D grid into a 1D array → Sort it → Pick the middle element (median) as the target → Count total operations using the absolute difference divided by x No guessing. No unnecessary loops. Just math doing the heavy lifting. ⚠️ The Constraint Check Nobody Talks About Before applying any operations — check if all elements share the same remainder when divided by x. If they don't, it's mathematically impossible to make the grid uni-value. Return -1 immediately and save the computation entirely. This "fail fast" mindset is just as important as the algorithm itself. 📈 Complexity Breakdown → Flatten + Sort → O(n log n) → Single pass to count operations → O(n) → Space → O(n) for the flattened array Simple, clean, and efficient. 🧠 What This Problem Reinforced ✅ Greedy thinking with median optimization ✅ Handle impossible cases before computation — fail fast ✅ Transform 2D problems into simpler 1D forms ✅ Let math do the heavy lifting before writing a single loop The best solutions often come from asking: "What does math already know about this?" On to the next challenge 💪 👇 What's a problem where a simple insight saved you from overcomplicating things? Drop it in the comments — would love to learn from your experience! #100DaysOfCode #LeetCode #DSA #Java #ProblemSolving #CodingJourney #SoftwareEngineering #Programming
To view or add a comment, sign in
-
-
Day 44- Ever wondered how one class can use another class without inheriting it? That’s exactly what the Has-A relationship is all about. Instead of making one class do everything, we let classes work together. 🔹 What is Has-A relationship? Has-A means: One class contains another class as a part of it. It doesn’t inherit behavior, it simply uses another object to perform tasks. This helps in building clean and modular code. 🔹 Let’s understand with a simple example class Test { void play() { System.out.println("Executing play()......"); } } class Example { Test ref; Example(Test ref) { this.ref = ref; } } public class MainClass2 { public static void main(String[] args) { Test t1 = new Test(); Example e1 = new Example(t1); e1.ref.play(); } } 🔹 What’s happening here? • A Test object is created • That object is passed into Example • Example stores it using a reference (ref) • Then Example uses it to call play() 🔹 Why this is Has-A? Because: 👉 Example HAS-A Test object 👉 It is not extending Test 👉 It is simply using Test’s functionality 🔹 Type of relationship here This is Aggregation (Weak Has-A) ✔ The Test object exists independently ✔ It is created outside and passed into Example ✔ Both classes are loosely connected 🔹 Why this matters Using Has-A relationship helps in: • Better code structure • Reusability of classes • Loose coupling • Real-world modelling Instead of writing one big class, we design systems where objects collaborate. #Java #OOP #ObjectOrientedProgramming #JavaProgramming #Coding #Programming #SoftwareDevelopment #Developer #LearningInPublic #TechLearning #ComputerScience #CodingJourney #CodeNewbie #JavaDeveloper
To view or add a comment, sign in
-
Explore related topics
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