find max value 的空间复杂度
在上一道练习中,您刚实现的代码里,findMaxValue 方法的空间复杂度是多少?
public int findMaxValue(int[] data) {
// Initialize the maximum value to the first element
int max = data[0];
for (int value : data) {
// Update max if current element is greater
if (value > max) {
max = value;
}
}
return max;
}
本练习是课程的一部分
