Mode entretien. Minuteur de 7 min, sans indices ni autocomplétion
Shelves with Remarque
FacileMap and Set7 min
A library has two dictionaries. In shelves the key is a shelf number and the value is an array of books on it. In authors the key is a book title and the value is its author.
Write a function shelvesWithAuthor(shelves, authors, author). It returns an array of the shelves that have at least one book by that author. Any order of shelves is fine.
Exemples
shelvesWithAuthor({ 1: ['Three Comrades'], 2: ['The Idiot'], 3: ['Arch of Triumph', 'Three Comrades'] }, { 'Three Comrades': 'Remarque', 'The Idiot': 'Dostoevsky', 'Arch of Triumph': 'Remarque' }, 'Remarque')Renvoie [ '1', '3' ]
shelvesWithAuthor({ 1: ['The Idiot'] }, { 'The Idiot': 'Dostoevsky' }, 'Remarque')Renvoie []
Posé chez T-Bank · Source
Chargement de l'éditeur...
- Entrée
shelvesWithAuthor({ '1': [ 'Three Comrades' ], '2': [ 'The Idiot' ], '3': [ 'Arch of Triumph', 'Three Comrades' ] }, { 'Three Comrades': 'Remarque', 'Arch of Triumph': 'Remarque', 'All Quiet on the Western Front': 'Remarque', 'The Idiot': 'Dostoevsky', 'The Master and Margarita': 'Bulgakov', 'Heart of a Dog': 'Bulgakov' }, 'Remarque')Attendu[ '1', '3' ] - Entrée
shelvesWithAuthor({ '1': [ 'The Idiot' ] }, { 'Three Comrades': 'Remarque', 'Arch of Triumph': 'Remarque', 'All Quiet on the Western Front': 'Remarque', 'The Idiot': 'Dostoevsky', 'The Master and Margarita': 'Bulgakov', 'Heart of a Dog': 'Bulgakov' }, 'Remarque')Attendu[] - Entrée
shelvesWithAuthor({ '1': [ 'Heart of a Dog', 'The Idiot' ], '2': [ 'Three Comrades' ], '3': [ 'The Master and Margarita' ] }, { 'Three Comrades': 'Remarque', 'Arch of Triumph': 'Remarque', 'All Quiet on the Western Front': 'Remarque', 'The Idiot': 'Dostoevsky', 'The Master and Margarita': 'Bulgakov', 'Heart of a Dog': 'Bulgakov' }, 'Bulgakov')Attendu[ '1', '3' ]
Les tests cachés se lancent à la soumission