Skip to content

Instantly share code, notes, and snippets.

@jangorecki
Last active Oct 20, 2015
Embed
What would you like to do?
R FizzBuzz
f = seq(3,100,3)
b = seq(5,100,5)
fb = f[f %in% b]
f = f[!f %in% fb]
b = b[!b %in% fb]
x = as.character(1:100)
x[f] = "Fizz"
x[b] = "Buzz"
x[fb] = "FizzBuzz"
cat(x, sep = "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment