Users Pricing

forum

Home Forums swap keys and duplicate values in hashmap – MindStick

swap keys and duplicate values in hashmap

Anonymous User 2018 22 Apr 2015
Hey Everyone,
I have interesting question on hash map and it says : 

I have a hash map with values : {"1-a","2-a","3-b","4-b"} 
Keys Values 
1 a 
2 a 
3 b 
4 b 

I need to swap the key values with losing the data , means the new hash map should be : 
Keys Values 
a 1,2 
b 3,4 

Can anyone suggest me the way to do this?

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md