Scrabble puzzle discussion


#128

Look into how you handle tiebreakers (hint: you don’t).

From the problem description, if 2 words count for the same number of points, the one that appears first in the dictionary should be given. Note that a hashset has no ordering; the item you put into it first may or may not be the one that you look at first when you go a foreach.


#129

Thanks, words with same score, choosing the shortest word instead of the first one made submission pass 100%. The current puzzle submission validation is wrong for large dictionary 1/2 or description is missleading:
“If two words win the same number of points, then the word which appears first in the order of the given dictionary should be chosen.”


#130

In Java to have insertion-ordered items in a HashSet, use LinkedHashSet.


#133

There are not enough letters in player’s hand for “restaurateur”. Every letter may be used once, as intro says.


#134

There is actually one test which is wrong. The “valid word” test being run after submission, is actually giving an amount of letters which is not equal to 7.


#135

You’re right. We’ll look into it.


#136

So I am confused. When I readline() all I am getting is the value 5 instead of the dictionary. As some who just started programming, I am rather confused as to what I should in order to get the values provided by the dictionary. Thus, it would be greatly appreciated if anyone could help me understand how I gain the values of the dictionary.


#137

There is a bug. The stub (default generated code) is almost empty. We’ll look into it.


#138

Problem fixed, thanks for the report. You might need to reset your code to get the proper default code.


#139

There seems to be a bug in my code. By right my output should be a word that scores 12 points and I know its wrong. But instead, I don’t even get an output all I get is undefined. Here is my code:

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/
let arr = []
let arr2 = []
var N = parseInt(readline());
for (var i = 0; i < N; i++) {
    var W = readline();
    arr.push(W)
}
var LETTERS = readline();
let arr3 = []
let y = 0
// Write an action using print()
// To debug: printErr('Debug messages...');
let values = {'a':1,'b':3,'c':3,'d':2,'e':1,'f':4,'g':2,'h':4,'i':1,'j':8,'k':5,'l':1,
'm':3,'n':1,'o':1,'p':3,'q':10,'r':1,'s':1,'t':1,'u':1,'v':4,'w':4,'x':8,'y':4,'z':10}
for(let i = 0;i<arr.length;i++){
    y = 0
    arr3 = arr[i].split('')
    for(let x = 0;x<arr3.length;x++){
        y += values[arr3[x]]
        }
        arr2.push(y)
        }
let sumIndex = arr2.reduce(function(p,n){
if(p>n){return [p]}
if(p===n){return [p,n]}
else{return [n]}
})
for(let i = 0;i<sumIndex.length;i++){
print(arr[arr2.indexOf(sumIndex[i])])
}

Please do help because I am confused as to why this is the case. Is the code wrong? And if it is, how so?


#140

Has anybody figured this out? I’m having the same problem


#141

Wait never mind I figured it out! To anybody wondering it’s most likely because you forgot that you don’t have to use all of the letters.


#142

I’m having an issue right now where I pass all of the test cases, but for some reason when I submit, the 2 words with different values test is supposedly wrong(says that it is hardcoding). I don’t know how to fix this because I am getting the correct answer, and I don’t know how I’m hard coding. Anyone know how I could fix this


#143

Did you ever figure this out? I’m having the same problem


#144

Hey there,

I have the same issue as Bridgetn58: all my tests passes, but when I submit the “2 words with different values” test fails and I have no clue about the reason. I tested my code with different output, more than the ones in the test, the chosen one is always the one with highest value. I made the test in PHP.
Can anyone help?

Thanks,


#145

I’ll send the validator test by PM.


#146

It helped me finding my error, thank you!


#147

Thanks for your examples, I had problem with validation for the third too, it helped me to find my problem and solve it.


#148

I have the same probleme with test number 3. Can I have the validator by PM ?

Thanks


#149

I finally find my little mistake. Thank you :slight_smile: