提交 1fd608c7 编写于 作者: M Mars Liu

fixed error in exercise max value

上级 db9cf853
......@@ -22,8 +22,11 @@ max(array);
```java
int max(int[] array){
int result = 0;
for(int i=0;i<array.length;i++){
if(array.length == 0){
return 0;
}
int result = array[0];
for(int i=1;i<array.length;i++){
int value = array[i];
if(value > result){
result = value;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册