#369
The Quiz Aggregator
Difficulty: | Easy |
Topics: | Real life cases List of Maps |
Mission: "Quiz Aggregator" menantang lo untuk membuat sistem agregasi soal pilihan ganda dari berbagai topik. Diberikan list of maps yang berisi :topic, :difficulty, dan :questions (sebuah list of strings yang mewakili soal). Elo diminta untuk menyusun ulang data menjadi map baru dengan :topic sebagai kunci utama dan nilai berupa map lain yang memetakan :difficulty ke list of :questions. Urutkan :questions dalam setiap :difficulty berdasarkan abjad.
(= (__ [{:topic "Math" :difficulty "Easy" :questions ["1+1=?", "2+2=?"]} {:topic "Math" :difficulty "Hard" :questions ["Integrate x^2"]} {:topic "Science" :difficulty "Easy" :questions ["Water H2O is"]}) {"Math" {"Easy" ["1+1=?", "2+2=?"], "Hard" ["Integrate x^2"]}, "Science" {"Easy" ["Water H2O is"]}}) | |
(= (__ [{:topic "History" :difficulty "Medium" :questions ["Who discovered America?"]} {:topic "History" :difficulty "Easy" :questions ["Capital of France?"]} {:topic "Geography" :difficulty "Easy" :questions ["Mount Everest is located in?"]}]) {"History" {"Medium" ["Who discovered America?"], "Easy" ["Capital of France?"]}, "Geography" {"Easy" ["Mount Everest is located in?"]}}) | |
(= (__ []) {}) | |
(= (__ [{:topic "Programming" :difficulty "Medium" :questions ["What is polymorphism?", "Explain closures"]} {:topic "Programming" :difficulty "Easy" :questions ["What does 'var' stand for?"]}]) {"Programming" {"Medium" ["Explain closures", "What is polymorphism?"], "Easy" ["What does 'var' stand for?"]}}) |