# Different Ways

# Different Ways

lando_loeper + 0 comments My approach was to bottom-up fill an array

`A[i][j]`

. Where each cell represents the total number of ways you can select`i`

elements from`j`

possibiliities. The answer to the problem would be represented by the cell`A[k-1][n-1]`

.The solution seems right, nevertheless I get a "Timeout Error" for the testcases 3 & 5. Is there a much more efficient way to solve that problem?

16wh1a0556 + 0 comments I am unable to inculde the clojure.math.combinatorics namespace could someone help me.. i am beginner in clojure.

(ns clojure.core (:require [clojure.string :as str]) (:require [clojure.math.combinatorics :as combo]) (:gen-class))

(def test_cases (Integer/parseInt(read-line)))

(dotimes[r test_cases] (def l (str/split (read-line) #"\s+"))

(def n1 (Integer/parseInt(nth l 0))) (def n2 (Integer/parseInt(nth l 1)))

(println(combo/count-combinations n1 n2)))

bbyalcinkaya + 0 comments non-DP solution is accepted lol

flirtseverywhere + 0 comments simple problem of combination. kCn

No more comments

Sort 4 Discussions, By:

Please Login in order to post a comment