This file contains hidden or 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
module LeapYear(isLeapYear) where | |
isLeapYear :: Int -> Bool | |
isLeapYear x | |
| isDivisible 400 = True | |
| isDivisible 100 = False | |
| isDivisible 4 = True | |
| otherwise = False | |
where isDivisible year = mod x year == 0 |
This file contains hidden or 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 raindrops | |
import "fmt" | |
func Convert(num int) string { | |
return ConvertCompare(num, "A") | |
} | |
func ConvertCompare(num int, compare string) string { |
This file contains hidden or 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
PASS | |
BenchmarkConvertA 300000 5625 ns/op | |
BenchmarkConvertB 300000 5756 ns/op | |
ok _/home/benjica/exercism/go/raindrops 3.532s |
This file contains hidden or 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
public class Hello { | |
public static void main(String[] args) { | |
System.out.println("Hello, world"); | |
} | |
} |
This file contains hidden or 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 hamming | |
// An asynchronous permutation Iterator for bitstrings | |
// So you want all the permuations of 3 bits choose 2 at a time? Well just | |
// create this async iterator which produces these bitstrings as there integer | |
// equivlent. | |
// | |
// bspIterator(3,2) | |
// 011 = 3 | |
// 101 = 5 |
This file contains hidden or 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 bitstring | |
//GistID: c9e651c9b075fc96e966 | |
// An asynchronous permutation Iterator for bitstrings | |
// So you want all the permuations of 3 bits choose 2 at a time? Well just | |
// create this async iterator which produces these bitstrings as there integer | |
// equivlent. | |
// | |
// bspIterator(3,2) |
This file contains hidden or 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
import java.util.Queue; | |
import java.util.Random; | |
import java.util.concurrent.ConcurrentLinkedQueue; | |
public class ThreadQueue { | |
public static final int SECONDS = 1000; | |
private Queue<Runnable> mProcessQueue; | |
This file contains hidden or 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
public class List { | |
private static final int INITIAL_ARRAY_SIZE = 6; | |
private static final char NULL_CHAR = '\u0000'; | |
private char[] mBackingStore; | |
private int mLength; | |
public List() { | |
mBackingStore = new char[INITIAL_ARRAY_SIZE]; | |
mLength = 0; |
This file contains hidden or 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 widgets | |
import "fmt" | |
// A IBiz is any type that implements the Baz function | |
type IBiz interface { | |
Baz() | |
} | |
// A Biz is our non client supported type |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.