language: JavaScript (spidermonkey) (spidermonkey-1.7)
date: 117 days 4 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function task(input){
        var map = {};
       
        //Count chars
        for(var i=0;i<input.length;i++){
                var char = input[i];
                if(!map[char]){
                        map[char] = 1;
                }else{
                        map[char] = map[char]+1;
                }
        }
 
        //Check check HackerCup
        var testStr = "HACKERCUP";
        var wordCount = 0;
       
        while(true){
                for(var i=0;i<testStr.length;i++){
                        var char = testStr[i];
                        if(map[char]>0){
                                map[char] = map[char]-1;
                        }else{
                                return wordCount;
                        }
                }
                wordCount++;
        }
        return input;
}
  • upload with new input
  • result: Success     time: 0.02s    memory: 4980 kB     returned value: 0

    5
    20 6 hacker cup
    100 20 hacker cup 2013
    10 20 MUST BE ABLE TO HACK
    55 25 Can you hack
    100 20 Hack your way to the cup