I am new to java. I have a problem that, I have two arrays parentArray and subArray:
parentArrayhas values,{1,4,4,3,6}subArrayhas values{4,4,3}
So, the second array or so-called subArray values are included in the first-array the so-called parentArray, with indexes starting from [1,2,3]. My question is how can we return the index value of the first element of subArray which is also part of parentArray.
i.e.
int[] parentArray = new int[]{1,4,4,3,6};
int[] subArray = new int[]{4,4,3};
As subArray's values are in parentArray starting index from [1], I want my program to return 1.
I have tried comparing two arrays and returning the common elements from both arrays. But ahead of that, I can not think any of logic as I am a beginner.