SHARE
TWEET

Anna's Homework drill

zvoulgaris Jan 31st, 2020 104 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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top