Question: please write code Write a method with the following header: publie static int lastindexof(int[] arr, int x) The method should find the last occurrence of
Write a method with the following header: publie static int lastindexof(int[] arr, int x) The method should find the last occurrence of x inside arr and return its index. If x isn't found in arr, the method should re turn 1. For example, suppose arr is {9,13,2,8,13,8,13,9}. If x is 13 , then the method should return 6, which is the Index of the last occurrence of 13 . If x is 14 , then the method should return 1, since 14 does not appear in arr. Note: Just submit the method .. not the entire program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
