Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

普通容易理解的方式 #592

Open
zhangzhangjing opened this issue Mar 11, 2025 · 0 comments
Open

普通容易理解的方式 #592

zhangzhangjing opened this issue Mar 11, 2025 · 0 comments

Comments

@zhangzhangjing
Copy link

const arr = [10, 21, 0, -7, 35, 7, 9, 23, 18]
var pos = 0
var num = arr[0]
for (var i = 1; i < arr.length; i++) {
if (arr[i] > 0 && arr[i] < num) {
num = arr[i]
pos = i
}
}
return pos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant