We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
List Replication
List Replication
Sort by
recency
|
185 Discussions
|
Please Login in order to post a comment
Scala resolution
def f(num: Int, arr: List[Int]): List[Int] = arr.flatMap(x => for (i <- 1 to num) yield x)
Thanks for the solution, https://www.apiflange.com/ I was looking for it for my site
Having trouble getting this one to work even with the solutions that are posted on the leaderboard, using Clojure, compile time error ;-;
racket.rkt
lang racket
; Enter your code here. Read input from STDIN. Print output to STDOUT
(let ((Reps (read-line)))
(let while()
(let ((maPrintedBoy (read-line))) (if (eof-object? maPrintedBoy) (exit 0) ((displayln maPrintedBoy) (for ([i (- (string->number Reps) 1)]) (displayln maPrintedBoy) ) (while) )
)
) )
Haskell | Easy to understand | Recursion