Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1024770 // indexOfMaxEntryInIntArray

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (1654L/11K).

1  
static int indexOfMaxEntryInIntArray(int[] a) {
2  
  int bestIndex = -1, bestValue = Int.MIN_VALUE;
3  
  int n = l(a);
4  
  for i to n: {
5  
    int x = a[i];
6  
    if (x > bestValue) {
7  
      bestIndex = i;
8  
      bestValue = x;
9  
    }
10  
  }
11  
  ret bestIndex;
12  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024770
Snippet name: indexOfMaxEntryInIntArray
Eternal ID of this version: #1024770/2
Text MD5: d14d02c0611cabfa7f0df2b9f09c0f5b
Transpilation MD5: d6a5bbafca4fb0878ac44726b988ac43
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-24 18:57:08
Source code size: 253 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 225 / 283
Version history: 1 change(s)
Referenced in: [show references]