Question: Need to get answers for this in Python. And please show correct outputs with testing. Thank you. Task 1 1 2 There are N trees
Need to get answers for this in Python. And please show correct outputs with testing. Thank you.



![is located at coordinates (X[K), Y[K]). 3 We want to build the](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66fa4ce668a2d_71766fa4ce59dfc0.jpg)
Task 1 1 2 There are N trees (numbered from 0 to N-1) in a forest. The K-th tree is located at coordinates (X[K), Y[K]). 3 We want to build the widest possible vertical path, such that there is no tree on it. The path must be built somewhere between a leftmost and a rightmost tree, which means that the width of the path cannot be infinite. What is the width of the widest possible path that can be built? Write a function: def solution(X, Y) II that, given two arrays X and Y consisting of N integers each, denoting the positions of trees, returns the width of the widest possible path that can be built. Examples: 1. Given X=[1, 8, 7,3,4, 1,8], Y=[6,4, 1, 8, 5, 1, 7), the function should return 3. 8 7 4 3 Task 1 2. Given X=[5, 5, 5, 7, 7, 7), Y=[3, 4, 5, 1, 3, 7) , the function should return 2. 8 7 3 2 0 1 2 3 4 5 6 7 8 9 10 11 12 3. Given X=[6, 10, 1,4,3], Y=[2,5, 3, 1,6], the function should return 4. 5 2 3. Given X=[6, 10, 1, 4, 3), Y=(2, 5, 3, 1, 6), the function should return 4. 6 5 4 3 2. 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 4. Given X=[4, 1, 5, 4], Y=[4, 5, 1, 3), the function should return 3. 8 7 6 4 3 Task 1 1 0 8 9 10 11 12 2 1 0 2. 4 5 6 7 3 3 4. Given X=[4, 1, 5, 4), Y=[4, 5, 1, 3), the function should return 3. 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 Write an efficient algorithm for the following assumptions: N is an integer within the range [2..100,000); each element of arrays X, Y is an integer within the range [O.. 1,000,000,000); there are no two trees with the same coordinates; . a path of width at least 1 can always be built
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
