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.nio.file.Files; | |
| import java.nio.file.Paths; | |
| import java.util.List; | |
| import java.util.ArrayList; | |
| import java.io.IOException; | |
| import java.io.BufferedReader; | |
| import java.io.InputStreamReader; | |
| public class Replicate { | |
| public static void main(String []args) throws IOException, InterruptedException { |
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.math.BigInteger; | |
| public class Replicate { | |
| public static void main(String []args) { | |
| Integer n = 100; | |
| BigInteger bn = new BigInteger(n.toString()).pow(n); | |
| while (!bn.equals(BigInteger.ZERO)) { | |
| System.out.print('A'); | |
| bn = bn.subtract(BigInteger.ONE); | |
| } | |
| System.out.println(); |
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.stream.LongStream; | |
| public class Replicate { | |
| public static void replicate(String s, long max) { | |
| LongStream.iterate(0, n -> n + 1).limit(max).forEach(n -> System.out.print("A")); | |
| System.out.println(); | |
| } | |
| public static void main(String []args) { | |
| int n = 11; |
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 main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "io" | |
| "os" | |
| "strconv" | |
| "strings" | |
| ) |
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 Data.List | |
| import qualified Data.Map.Strict as Map | |
| import qualified Data.Tree as Tree | |
| import qualified Data.Graph as Graph | |
| points :: [[Int]] -> Int -> Int -> [((Int,Int), Int)] | |
| points area width height = zip keys (concat area) | |
| where | |
| keys = [(r,c) | r <- [0..(height-1)], c <- [0..(width-1)]] |
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 main | |
| import ( | |
| "fmt" | |
| "go/ast" | |
| "go/parser" | |
| "go/token" | |
| "os" | |
| "strings" | |
| ) |
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 main | |
| import ( | |
| "bytes" | |
| "fmt" | |
| "strings" | |
| ) | |
| func main() { | |
| // Read first line |
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 Control.Monad (replicateM) | |
| parseTokens:: String -> [String] | |
| parseTokens tokenStr = parseTokens' [] "" False tokenStr | |
| where | |
| parseTokens' acc word isGroup "" = acc | |
| parseTokens' acc word isGroup (x:xs) | |
| | not isGroup && x == '(' = parseTokens' acc "" True xs | |
| | not isGroup && x /= '(' = parseTokens' (acc++[[x]]) "" False xs |
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
| rotate xs n | n >= 0 = zipWith (\_ x -> x) xs $ drop n $ cycle xs | |
| | otherwise = take len $ drop dropLen $ (cycle xs) | |
| where | |
| len = length xs | |
| dropLen = (len + (n `mod` (-len))) |
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
| rotate xs n | n >= 0 = drop n xs ++ take n xs | |
| | otherwise = drop (length xs + n) xs ++ take (length xs + n) xs |