Skip to content

Commit

Permalink
Problem added - Count Occurences
Browse files Browse the repository at this point in the history
  • Loading branch information
dbyrne committed Apr 23, 2011
1 parent e6824ac commit 2b806e1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/foreclojure/data_set.clj
Expand Up @@ -549,4 +549,15 @@
:tags ["medium" "seqs" "core-functions"]
:tests ["(= (__ 3 (range 9)) '((0 1 2) (3 4 5) (6 7 8)))"
"(= (__ 2 (range 8)) '((0 1) (2 3) (4 5) (6 7)))"
"(= (__ 3 (range 8)) '((0 1 2) (3 4 5)))"]})))
"(= (__ 3 (range 8)) '((0 1 2) (3 4 5)))"]})

(insert! :problems
{:_id 55
:title "Count Occurences"
:times-solved 0
:restricted ["frequencies"]
:description "Write a function which returns a map containing the number of occurences of each distinct item in a sequence."
:tags ["medium" "seqs" "core-functions"]
:tests ["(= (__ [1 1 2 3 2 1 1]) {1 4, 2 2, 3 1})"
"(= (__ [:b :a :b :a :b]) {:a 2, :b 3})"
"(= (__ '([1 2] [1 3] [1 3])) {[1 2] 1, [1 3] 2})"]})))

0 comments on commit 2b806e1

Please sign in to comment.