# Day 8: Dictionaries and Maps In Java | 30 Days Of Code | Hackerrank Programming Solutions

Hello Programmers/Coders, Today we are going to share solutions of Programming problems of 30 Days Of Code, HackerRank. At Each Problem with Successful submission with all Test Cases Passed, you will get an score or marks. And after solving maximum problems, you will be getting stars. This will highlight your profile to the recruiters.

In this post, you will find the solution for Day 8: Dictionaries and Maps in Java-HackerRank Problem. We are providing the correct and tested solutions of coding problems present on HackerRank. If you are not able to solve any problem, then you can take help from our Blog/website.

`Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.`

Link for the ProblemDay 8: Dictionaries and Maps – Hacker Rank Solution

`Day 8: Dictionaries and Maps – Hacker Rank Solution`

### Problem:

Objective
Today, we’re learning about Key-Value pair mappings using a Map or Dictionary data structure. Check out the Tutorial tab for learning materials and an instructional video!

Given  names and phone numbers, assemble a phone book that maps friends’ names to their respective phone numbers. You will then be given an unknown number of names to query your phone book for. For each  queried, print the associated entry from your phone book on a new line in the form `name=phoneNumber`; if an entry for  is not found, print `Not found` instead.

Note: Your phone book should be a Dictionary/Map/HashMap data structure.

Input Format

The first line contains an integer, , denoting the number of entries in the phone book.
Each of the  subsequent lines describes an entry in the form of  space-separated values on a single line. The first value is a friend’s name, and the second value is an -digit phone number.

After the  lines of phone book entries, there are an unknown number of lines of queries. Each line (query) contains a  to look up, and you must continue reading lines until there is no more input.

Note: Names consist of lowercase English alphabetic letters and are first names only.

Constraints

Output Format

On a new line for each query, print `Not found` if the name has no corresponding entry in the phone book; otherwise, print the full  and  in the format `name=phoneNumber`.

Sample Input

```3
sam 99912222
tom 11122222
harry 12299933
sam
edward
harry```
`Day 8: Dictionaries and Maps – Hacker Rank Solution`
```import java.util.HashMap;
import java.util.Scanner;

/**
*
*/
public class Day8DictionariesAndMaps {
public static void main(String[] argh) {
Scanner in = new Scanner(System.in);
HashMap<String, Integer> hmap = new HashMap<String, Integer>();
int n = in.nextInt();
for (int i = 0; i < n; i++) {
String name = in.next();
int phone = in.nextInt();
hmap.put(name, phone);
// Write code here
}
while (in.hasNext()) {
String s = in.next();

if (hmap.containsKey(s)) {
System.out.println(s + "=" + hmap.get(s));

} else {
}

// Write code here
}
in.close();
}
}```

### 45 thoughts on “Day 8: Dictionaries and Maps In Java | 30 Days Of Code | Hackerrank Programming Solutions”

1. I simply wanted to convey how much I’ve gleaned from this article. Your meticulous research and clear explanations make the information accessible to all readers. It’s abundantly clear that you’re committed to providing valuable content.

2. Thank you, I’ve recently been looking for information approximately this subject for
ages and yours is the best I’ve came upon till now. But, what concerning the conclusion?
Are you positive concerning the source?

3. This text is priceless. How can I find out more?

4. Sight Care is a natural supplement designed to improve eyesight and reduce dark blindness. With its potent blend of ingredients. https://sightcarebuynow.us/

5. Covering the latest beauty and fashion trends, relationship advice, wellness tips and more. https://gliz.us/

6. Breaking US news, local New York news coverage, sports, entertainment news, celebrity gossip, autos, videos and photos at nybreakingnews.us https://nybreakingnews.us/

7. The latest news on grocery chains, celebrity chefs, and fast food – plus reviews, cooking tips and advice, recipes, and more. https://megamenu.us/

8. Healthcare Blog provides news, trends, jobs and resources for health industry professionals. We cover topics like healthcare IT, hospital administration, polcy

9. BioPharma Blog provides news and analysis for biotech and biopharmaceutical executives. We cover topics like clinical trials, drug discovery and development, pharma marketing, FDA approvals and regulations, and more. https://biopharmablog.us/

10. East Bay News is the leading source of breaking news, local news, sports, entertainment, lifestyle and opinion for Contra Costa County, Alameda County, Oakland and beyond https://eastbaynews.us/

11. News from the staff of the LA Reporter, including crime and investigative coverage of the South Bay and Harbor Area in Los Angeles County. https://lareporter.us/

12. I am now not positive where you are getting
your information, however good topic. I needs to spend a while studying much more
or understanding more. Thanks for great information I
used to be on the lookout for this information for my
mission.

13. indiaherald.us provides latest news from India , India News and around the world. Get breaking news alerts from India and follow today’s live news updates in field of politics, business, sports, defence, entertainment and more. https://indiaherald.us

14. Yolonews.us covers local news in Yolo County, California. Keep up with all business, local sports, outdoors, local columnists and more. https://yolonews.us/

15. The one-stop destination for vacation guides, travel tips, and planning advice – all from local experts and tourism specialists. https://travelerblog.us/

16. Outdoor Blog will help you live your best life outside – from wildlife guides, to safety information, gardening tips, and more. https://outdoorblog.us/

17. Scrap metal industry certifications Aluminum scrap prices Aluminium scrap CNC cutting
Metal reclaiming and recycling solutions, Aluminum cable recycling machines, Scrap metal lifecycle management

18. Metal reclamation and reuse Aluminium scrap recycling value Aluminium shredding
Metal scraps reprocessing, Aluminum cable recycling regulations, Scrap metal recycling plant

19. Scrap metal recycling Aluminum scrap transport Scrap aluminium value realization
Metal waste disposal facility, Aluminum cable stripping machines, Metal waste cleaning

20. Metal reclamation and recovery facility Aluminium scrap reusability Aluminium refurbishment
Metal waste management services, Aluminum cable scrap weight measurements, Scrap metal recovery depot

21. Scrap metal recovery Scrapping aluminum Aluminium recycling industry news
Scrap metal processing plant, Aluminum cable recycling guidelines, Metal recyclable materials

22. The Boston Post is the leading source of breaking news, local news, sports, politics, entertainment, opinion and weather in Boston, Massachusetts. https://bostonpost.us/

23. Foodie Blog is the destination for living a delicious life – from kitchen tips to culinary history, celebrity chefs, restaurant recommendations, and much more. https://foodieblog.us/

24. colibrim.com web site.

25. Scrap metal procurement strategies Metal reclamation and salvage Iron waste reclamation solutions

Ferrous material resource management, Iron recycling and recovery solutions, Metal scrap reprocessing yard

26. Bazopril is a blood pressure supplement featuring a blend of natural ingredients to support heart health

27. Metal scrap breakup Ferrous material storage Iron resource recovery

Ferrous material waste treatment, Iron scrap dismantling services, Scrap metal reclamation and reutilization solutions

28. Scrap metal recycler Ferrous waste reclaiming facility Iron scrap recycling center

Ferrous material recycling technology updates, Iron scrap reclamation operations, Metal recyclable waste solutions

29. AGENCANTIK
AGENCANTIK says Thank you very much, all the information above is very good and interesting

30. от воронежа до кучугур сколько
км на машине прокудин горский фото тверь подать данные по электроэнергии волгоград
рогачева ольга владимировна астрахань реконструкция варшавского шоссе до подольска аптека
на московском шоссе 42 серпухов