← 返回 snapchat 的题目列表Maximum Difference in Connected Graphs
类型:online_judge
Given an undirected graph with inputs: number of nodes, list of node from, and list of node to, return the maximum difference between each connected graph. For example, given input {4, [1, 2, 3], [2, 3, 1]}, the graph is 1<->2<->3. The difference is 3-1 = 2. If there are multiple connected subgraphs, return the largest difference.
Example
Input
4 1 2 3 2 3 1
Output
2