• + 0 comments

    For Ocaml

    let rec duplicate_arr n ch = 
        if (n > 0) then ch:: duplicate_arr (n-1) ch
        else []
        
    let rec f n arr = match arr with 
        | [] -> []
        | h::t -> (duplicate_arr n h)@(f n t)