Minimum Time to Collect All Apples in a Tree | leetcode | DSA | Hindi

Опубликовано: 26 Февраль 2026
на канале: ShashCode
2,262
67

Lecture Resources
https://github.com/Tiwarishashwat/Jav...

Problem Name:
1443. Minimum Time to Collect All Apples in a Tree

Problem Statement:
Given an undirected tree consisting of n vertices numbered from 0 to n-1, which has some apples in their vertices. You spend 1 second to walk over one edge of the tree. Return the minimum time in seconds you have to spend to collect all apples in the tree, starting at vertex 0 and coming back to this vertex.

The edges of the undirected tree are given in the array edges, where edges[i] = [ai, bi] means that exists an edge connecting the vertices ai and bi. Additionally, there is a boolean array hasApple, where hasApple[i] = true means that vertex i has an apple; otherwise, it does not have any apple.

Problem Link:
https://leetcode.com/problems/minimum...

Graph Playlist:
   • Graph Data Structure Series  

Samsung Interview Experience:
   • I cracked Samsung | SRIB Interview Experie...  

Company Tags:
Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung

Timestamp:
0:00 - Introduction

#ShashwatTiwari #coding​​ #problemsolving​