This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(reduce + | |
(distinct | |
(concat (range 3 1000 3)(range 5 1000 5)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def whole-numbers (iterate inc 1)) | |
(defn square [n] (* n n)) | |
(defn sum-of-squares [n] | |
(reduce + | |
(take n | |
(map square whole-numbers)))) | |
(defn square-of-sum [n] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def fibs | |
(map first | |
(iterate (fn [[a b]] [b (+ a b)]) [0 1]))) | |
(reduce + | |
(take-while | |
(partial > 4000000) (filter even? fibs))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rocketpush.puzzle; | |
public class FizzBuzz { | |
public static String fizzBuzz(boolean isFizzy, boolean isBuzzy, int i) { | |
String value = String.valueOf(i); | |
if (isFizzy && isBuzzy) { | |
value = "FizzBuzz"; | |
} else if (isFizzy) { | |
value = "Fizz"; |
NewerOlder