zvoulgaris

Anna's Homework drill

Jan 31st, 2020
178
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

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×