6
In the fewest bytes, generate the dictionary of keypresses for any letter (as described in https://code.google.com/codejam/contest/351101/dashboard#s=p2)
In Python, the dictionary literal itself:
{'a':2,'c':222,'b':22,'e':33,'d':3,'g':4,'f':333,'i':444,'h':44,'k':55,'j':5,'m':6,'l':555,'o':666,'n':66,'q':77,'p':7,'s':7777,'r':777,'u':88,'t':8,'w':9,'v':888,'y':999,'x':99,'z':9999}
is 187 bytes so it needs to be less than that. (The values can be strings or ints, ie you can have 'a':'2' or 'a':2 it's up to you)
NOTE: This is not asking you to solve the referenced GCJ problem, it's just asking you to generate a particular dictionary which is related to that problem.
EDIT: You may solve this in any language which has a dictionary-like type (ie hashmap, associative array etc.)
Do we have to solve this in Python, or can we use any language to generate and output the dictionary literal? – Ilmari Karonen – 2014-04-11T19:48:58.290
I guess any language. Let me fix that – dspyz – 2014-04-11T19:49:30.837
1
Also, looks like the GCJ problem itself has been asked here before.
– Ilmari Karonen – 2014-04-11T19:51:24.650Huh, I should have checked that first. I posted this because we were talking about how to generate this dictionary (in Python) on #gcj on Freenode – dspyz – 2014-04-11T19:53:25.210
Order doesn't matter? – kukac67 – 2014-04-11T20:22:24.393
You should be using an unordered data-type. This problem isn't to "output" the result, it's to "generate" it – dspyz – 2014-04-11T20:26:34.517
Do all values have to be the same type? ex:
{a:2,b:"22"...}
and do the dictionary keys have to be lowercase letters? – nderscore – 2014-04-11T21:04:29.037Is the idea to store it in a variable or to print a correctly-formatted dict literal? The latter seems more interesting – Claudiu – 2014-04-11T22:49:54.057