-
-
Save Titory0/e52a5f7b7066bc05f1555f8e43e5c860 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static int prototype(int[] list) | |
| { | |
| int indexsec=list.Length+1; | |
| for(int i=0;i<list.Length;i++ ) | |
| { | |
| for(int y=i;y<list.Length;y++ ) | |
| { | |
| if(list[i] == list[y] && i!=y) | |
| { | |
| if(y<indexsec) | |
| { | |
| indexsec=y; | |
| } | |
| } | |
| } | |
| } | |
| if (indexsec!=list.Length+1) | |
| { | |
| return list[indexsec]; | |
| } | |
| return -1; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment