Detecting Hidden Patterns #day19 of #100DaysOfCode ✅ Problems Solved 🔹 Find Duplicate Subtrees (LeetCode 652) Approach • Perform postorder traversal to capture subtree structure • Serialize each subtree into a string (node + left + right) • Use a hashmap to track the frequency of each serialization • Collect roots of subtrees that appear more than once Key takeaway : It’s not about brute force comparison — it’s about encoding. Once subtrees are serialized, duplicates reveal themselves naturally. The key realization : This problem highlights the power of representation: - Traversal defines how structure is captured - Serialization transforms trees into comparable signatures - Hashmaps expose repetition without extra overhead Day 19 is done. The chain continues. #LeetCode #Java #Consistency #coding #DSA #GeeksForGeeks #Programming #Daily #Learning Ikshit .. Anchal Sharma
Detecting Duplicate Subtrees with Serialization
More Relevant Posts
-
🎯 Day 68 of #100DaysOfCode 📌 Problem: Combination Sum II Today's challenge was a twist on the classic combination sum problem! Each number in candidates can only be used once, and the solution set must not contain duplicate combinations. 🧠 Approach: Sorted the array first to handle duplicates efficiently Used recursion with backtracking Skipped duplicate elements to avoid repeated combinations Explored all possible combinations by picking/unpicking elements 📊 Stats: ✅ 176/176 test cases passed ⚡ Runtime: 6 ms | Beats 73.38% 💾 Memory: 45.61 MB | Beats 19.56% 📝 Takeaway: The key challenge was avoiding duplicate combinations while ensuring each element is used at most once. Sorting + skipping duplicates during recursion made this elegant. Memory optimization is the next frontier! 🔗 Problem: Combination Sum II 🏷️ #LeetCode #CodingChallenge #Java #Backtracking #Recursion #Algorithms #DuplicateHandling #TechJourney #Programming
To view or add a comment, sign in
-
-
🔁 Recursion Made Simple When a function calls itself — that’s Direct Recursion. When it calls another function that calls it back — that’s Indirect Recursion. 💡 Example: Factorial of 6 6 × 5 × 4 × 3 × 2 × 1 = 720 Base Case ➝ Stops the recursion Recursive Call ➝ Breaks problem into smaller parts Think smaller. Solve smaller. Build bigger. 🚀 #Java #Recursion #Programming #CodingLife #DataStructures #LearnToCode
To view or add a comment, sign in
-
-
Arrays are data structures used to store multiple values of the same data type in a single variable. They help organize data efficiently, reduce the need for many variables, and allow quick access using index positions. Arrays are widely used in programming for storing lists, records, and structured data. #Arrays #Programming #Java #Coding #DataStructures #ComputerScience #BTech #StudentDeveloper #TechLearning #SoftwareDevelopment #CodingLife #LinkedInLearning 🚀 TAP Academy Sharath R
To view or add a comment, sign in
-
-
🚀 Day 66 / 100 Days of LeetCode Challenge ✅ Problem Solved: Binary Gap 💡 Goal: Find the longest distance between two consecutive 1s in the binary representation of a given integer. 🧠 Thought Process: Removed trailing zeros to start from the first 1. Handled edge case where number is 1 → return 0. Iterated through bits, tracking gap length between 1s. Updated max gap whenever a 1 was found. 📈 Result: ⚡ Runtime: 0 ms (Beats 100% 🎉) 💾 Memory: 42.56 MB (Beats 14.06%) 📝 Key Takeaway: Efficient bit manipulation can drastically simplify problems involving binary representations. Always consider using bitwise operators for performance gains! #LeetCode #100DaysOfCode #CodingChallenge #Java #BitManipulation #ProblemSolving #TechJourney #DeveloperLife #WomenInTech #CodeNewbie #Programming #DailyCoding #BinaryGap #LearnToCode #DSA #Algorithms
To view or add a comment, sign in
-
-
Scala Lists are simple on the surface—but incredibly powerful once you understand how they work. In this lesson, you’ll learn: • How Scala Lists are built using :: and Nil • Why prepending is the preferred operation for performance • How Lists are naturally decomposed into head and tail • How recursion works seamlessly with Lists using pattern matching • How identity elements make operations like sum, product, and concatenation possible Understanding Lists is essential for functional programming in Scala—and it helps you write clearer, more efficient, and more expressive code. Watch the full lesson here: https://buff.ly/d9ARbAF #Scala #FunctionalProgramming #Programming #SoftwareEngineering #Scala3 #LearnScala
To view or add a comment, sign in
-
-
🚀 Day 10 – How Arrays Really Work in Java Today I went beyond basic syntax and understood how arrays actually work internally in Java. 🔎 What I explored: ✔️ How arrays are stored in contiguous memory locations ✔️ How index-based access works (0-based indexing) ✔️ How array size is fixed after creation ✔️ How reference variables point to array objects in memory ✔️ Time complexity of accessing elements – O(1) Understanding the internal working of arrays helped me realize why they are fast for accessing elements but limited when it comes to resizing. This concept is very important before moving to advanced data structures like ArrayList, LinkedList, and more. 🙏 Special thanks to Aditya Tandon Sir for explaining the internal memory concept so clearly. #Day10 #Java #Arrays #DataStructures #LearningJourney #Programming #Coding #JavaDeveloper
To view or add a comment, sign in
-
-
Understanding OOP isn't about memorizing definitions. It's about understanding how software is structured in the real world. Encapsulation – Control what's exposed Polymorphism – One interface, many forms Inheritance - Reuse and extend behavior Abstraction - Hide complexity, show essentials Master these 4 pillars, and you master the foundation of scalable software. (Object Oriented Programming, OOP Concepts, Java Programming, Python OOP, Software Development, Coding Fundamentals, Data Structures, Programming Principles) #OOP #Java #Python #Programming #SoftwareEngineering #Coding #Developers #ComputerScience #TechLearning #jadugar7799
To view or add a comment, sign in
-
-
Today let's practice one of the strongest foundations in Java — Arrays. From basics like: ✔ Finding even numbers ✔ Reversing an array ✔ Sum & average To logic-building concepts like: ✔ Largest & smallest element ✔ Linear Search (Brute Force) ✔ Selection Sort Arrays may look simple… But they build real problem-solving skills and algorithmic thinking. I’ve uploaded all the programs here: https://lnkd.in/g_ZW9aqq Swipe through the carousel → Practice → Improve #Java #JavaFullStack #Arrays #CodingPractice #DSA #LearningInPublic #Programming
To view or add a comment, sign in
-
🚀 GeeksforGeeks – Problem of the Day Today's challenge was about finding a Pythagorean Triplet in an array. The problem is based on Arrays and mathematical logic. The task is to check whether an array contains a triplet (a, b, c) such that: a² + b² = c² we can solve this problem using the Two Pointer Approach after sorting the array. Checkout the problem 👇 GFG Problem Link: https://lnkd.in/gUK5_98Y #HappyCoding 😊 #datastructuresandalgorithms #geeksforgeeks #programming #codingchallenge #dailychallenge #problemsolvingskills #java #developers
To view or add a comment, sign in
-
-
Strong software doesn’t happen by accident — it’s designed with principles. The foundation of Object-Oriented Programming (OOP) stands on four key pillars: • Encapsulation – Protecting data and controlling access within a class. • Abstraction – Exposing only what’s necessary while hiding complexity. • Inheritance – Reusing and extending existing functionality efficiently. • Polymorphism – Allowing flexibility through multiple implementations of the same interface. Mastering these concepts transforms code from functional to structured, scalable, and maintainable. #OOP #Java #SoftwareDesign #Programming #ComputerScience
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