forgot password | create account
Or use
about | help | code help+videos | done | prefs
CodingBat code practice


Map-1 > mapBully
prev  |  next  |  chance

Modify and return the given map as follows: if the key "a" has a value, set the key "b" to have that value, and set the key "a" to have the value "". Basically "b" is a bully, taking the value and replacing it with the empty string.

mapBully({"b": "dirt", "a": "candy"}) → {"b": "candy", "a": ""}
mapBully({"a": "candy"}) → {"b": "candy", "a": ""}
mapBully({"b": "carrot", "c": "meh", "a": "candy"}) → {"b": "candy", "c": "meh", "a": ""}

...Save, Compile, Run

public Map<String, String> mapBully(Map<String, String> map) { }

Shorter output

Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 203 Post-solution available

Copyright Nick Parlante 2016 - privacy