Company: Uidai_2_Jan
Difficulty: medium
Village Route Population Sum Query body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; line-height: 1.6; } h1, h2 { border-bottom: 1px solid #ccc; padding-bottom: 10px; } code { background-color: #f0f0f0; padding: 2px 5px; border-radius: 4px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; } pre { background-color: #f5f5f5; padding: 15px; border-radius: 5px; white-space: pre-wrap; word-wrap: break-word; } .container { max-width: 800px; margin: 20px auto; padding: 20px; } .flex-container { display: flex; gap: 20px; } .flex-child { flex: 1; } Village Route Population Sum Query Problem Description You have a network of villages connected as a tree structure. There are N villages and each village has a distinct identifier. Between any pair of villages, there is exactly one connecting route. You are given two villages U and V which might be the same village