Question: In java 8 please Thank You. Task 2 You are given an implementation of a function: class Solution {public int solution(int [] A, int []

In java 8 please Thank You.
Task 2 You are given an implementation of a function: class Solution \{public int solution(int [] A, int [] B); \} that, given a non-empty array A of N non-negative integers and a non-empty array B of M non-negative integers, returns the minimal value that occurs in both arrays. If there is no such value, the function should return 1. For example, given arrays A and B such that: A[]=1A[1]=3A[2]=2A[3]=1B[]=4B[1]=2B[2]=5B[3]=3B[4]=2 your function should return 2 , since 2 is the minimal value which occurs in both arrays A and B (another value which occurs in both arrays is 3 ). Given arrays A and B such that: A[]=2A[1]=1B[]=3B[1]=3 your function should return 1, since there is no value that occurs in both arrays. The attached code is still incorrect for some inputs. Despite the error(s), the code may produce a correct answer for the example test cases. The goal of the exercise is to find and fix the bug(s) in the implementation. You can modify at most two lines
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
