We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
functionprocessData(input){constinputLines=input.split('\n');constentryCount=parseInt(inputLines[0]);constphoneBook={};for(leti=1;i<=entryCount;i++){const[name,phoneNumber]=inputLines[i].split(' ');phoneBook[name]=phoneNumber;}for(leti=entryCount+1;i<inputLines.length;i++){constqueryName=inputLines[i];if(queryName){// Check if there is a queryif(phoneBook[queryName]){console.log(`${queryName}=${phoneBook[queryName]}`);}else{console.log('Notfound');}}}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 8: Dictionaries and Maps
You are viewing a single comment's thread. Return to all comments →