MCPcopy
hub / github.com/qiyuangong/leetcode / max

Method max

java/654_Maximum_Binary_Tree.java:14–21  ·  view source on GitHub ↗
(int[] nums, int l, int r)

Source from the content-addressed store, hash-verified

12 return root;
13 }
14 public int max(int[] nums, int l, int r) {
15 int max_i = l;
16 for (int i = l; i < r; i++) {
17 if (nums[max_i] < nums[i])
18 max_i = i;
19 }
20 return max_i;
21 }
22 /*public TreeNode constructMaximumBinaryTree(int[] nums) {
23 // https://leetcode.com/problems/maximum-binary-tree/discuss/106146/C++-O(N)-solution
24 Stack<TreeNode> stack = new Stack<>();

Callers 15

constructMethod · 0.95
binaryGapMethod · 0.80
computeAreaMethod · 0.80
ipToCIDRMethod · 0.80
findRadiusMethod · 0.80
maximumProductMethod · 0.80
searchRangeMethod · 0.80
isRectangleOverlapMethod · 0.80
findUnsortedSubarrayMethod · 0.80
depthMethod · 0.80
maxWidthRampMethod · 0.80
longestPalindromeMethod · 0.80

Calls

no outgoing calls

Tested by 1

findUnsortedSubarrayMethod · 0.64