Advertisement
zvoulgaris

Anna's Homework drill

Jan 31st, 2020
274
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement