Advertisement
zvoulgaris

Anna's Homework drill

Jan 31st, 2020
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. # Anna's homework drill
  2.  
  3. function main(X::Array{Int64, 1}, n::Int64 = length(X))
  4. n3 = div(n, 3)
  5.  
  6. for i = 1:n
  7. c = sum(X .== X[i])
  8. if c >= n3; return X[i]; end
  9. end
  10.  
  11. return NaN
  12. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement