Problem Statement:
The system should identify a user's region based on their IP address.
IPv4 addresses are written as four numbers separated by periods, like "127.10.20.30". Each number is called an octet. Based on the first octet, addresses fall into one of five regions:
You are given a list of IP addresses. For each one, check if it is valid. If it is valid, return the region index (1 through 5). If it is not valid, return -1.
Problem Statement:
Given a tree with tree_nodes nodes, where each node i has an associated weight weight[i] (1-based indexing). The tree is rooted at node 1.
A subset of nodes is called "good" if there is no pair of nodes where one node is an ancestor of the other.
Find the maximum sum of weights from nodes that form a good subset.
Note: A node u is an ancestor of node v if it lies on the direct path from the root to node v.