This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

## 2019-07-01

## Channels

- # 100-days-of-code (2)
- # beginners (83)
- # calva (3)
- # cider (98)
- # clara (3)
- # clj-kondo (2)
- # clojure (84)
- # clojure-dev (59)
- # clojure-europe (11)
- # clojure-italy (22)
- # clojure-madison (29)
- # clojure-nl (3)
- # clojure-spec (24)
- # clojure-uk (80)
- # clojurescript (33)
- # clr (3)
- # datomic (59)
- # events (2)
- # fulcro (20)
- # interop (35)
- # jobs (6)
- # jobs-rus (1)
- # joker (3)
- # kaocha (2)
- # luminus (3)
- # off-topic (16)
- # other-languages (2)
- # pathom (17)
- # planck (2)
- # reagent (1)
- # shadow-cljs (1)
- # test-check (1)
- # tools-deps (49)
- # vim (16)

Sam is fond of chocolates, so Alex gave Sam some boxes of chocolates as a gift. Sam wants to choose one or more boxes of chocolates such that the average number of chocolates in the chosen boxes is exactly equal to some integer k. Given the number of chocolates in each box, determine the number of ways Sam can choose boxes such that the average number of chocolates across the chosen boxes is equal to k. Since the result may be very large, return the value modulo (109+7). For example, Alex bought 3 boxes of chocolates containing chocolate = [3, 2, 4] chocolates in the boxes. Sam wants to choose boxes such that the average number of chocolates among the chosen boxes is k = 3. The boxes can be selected in the following 3 ways: Take chocolate[0] having 3 chocolates. Take chocolate[0, 1, 2] having (3, 2, 4) chocolates respectively, (3+2+4)/3 = 3 Take chocolate[1, 2] having (2, 4) chocolates respectively, (2+4)/2 = 3 Return the answer 3%(109+7) = 3. Function Description Complete the function chocolateBoxes in the editor below. The function should return an integer, the number of ways to choose boxes, modulo (109+7). chocolateBoxes has the following parameter(s): k : an integer denoting the average number of chocolates chocolate[chocolate[0], chocolate[1] .... chocolate[n-1]]: an integer array where chocolate[i] denotes the number of chocolates in ith box. Constraints 1≤ k ≤ 50 1≤ n ≤ 50 1 ≤ chocolate[i] ≤ 50 Input Format For Custom Testing Sample Case 0 Sample Input For Custom Testing 3 6 3 2 4 5 1 12 Sample Output 7