Sort 8 Discussions, By:
Please Login in order to post a comment
Python2 template is broken: the first line of the input should be interpreted before the mapreduce (as in the other templates), so that the mapper receives the set name as the key instead of the line number..
Regarding the Java version.
Could you explain why JSONObject and some other wrappers are used?
I have tried to simplify the initial version provided:
Please mention the significance of LinkedHashMap in the template of java, why do we need the insertion order maintained in the inputdata json
Although R and S are mentioned as set, it would still be better to explicitly state that the numbers for each of the collections won't be repeated.
Also, line 176: "intermediate.put(key,temp);" (in Java code) is confusing, please remove it from the template.
Rest the code is elegant, beautiful and self-explainatory to say the least. Kudos to team Hackerrank for introducing such a challenge. :)
Think carefully about the keys used for the map; you can easily create intermediate values which already indicate the sets each integer appears in - no need to do this in the reduce.