MCPcopy Create free account
hub / github.com/apna-college/Alpha / lastOccurence

Method lastOccurence

7_RecursionBasics/RecursionBasics.java:72–82  ·  view source on GitHub ↗
(int arr[], int key, int i)

Source from the content-addressed store, hash-verified

70 }
71
72 public static int lastOccurence(int arr[], int key, int i) {
73 if(i == arr.length) {
74 return -1;
75 }
76 int isFound = lastOccurence(arr, key, i+1);
77 if(isFound == -1 && arr[i] == key) {
78 return i;
79 }
80
81 return isFound;
82 }
83
84 public static int power(int x, int n) {
85 if(n == 0) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected