• ###### Chrono79commented on "Highest Rank Number in an Array" kata

This input is wrong: `[12, 10, 8, 12, 7, 6, 4, 10, 12, 10, 10]` , it is like this: `[12, 10, 8, 12, 7, 6, 4, 10, 12, 10]` and it test if there are two numbers that are equally frequent, you return the highest. You can print the input with `console.log()` and it'll appear above the test result.

• ###### jiayuwaerncommented on "Highest Rank Number in an Array" kata

Hi, thank you for your reply, and yes I am receiving "expected 10 to deeply equal 12" all the time......
How I can see the Attempt test file?

Nice kata!

• ###### Chrono79commented on "Highest Rank Number in an Array" kata

And are you sure those are the tests your code doesn't pass when clicking Attempt?

• ###### jiayuwaerncommented on "Highest Rank Number in an Array" kata

Hey guys, I've made my own test with this:
describe("Tests", () => {
it("test", () => {
var arr = [12, 10, 8, 12, 7, 6, 4, 10, 12];
Test.assertSimilar( highestRank(arr), 12);
});
it("test", () => {
var arr = [12, 10, 8, 12, 7, 6, 4, 10, 12, 10, 10];
Test.assertSimilar( highestRank(arr), 10);
});
});

and my code passed both tests, but I still can not pass the Attempt test, any idea why??

• ###### Pablo Vent commented on "Highest Rank Number in an Array" kata

This comment is hidden because it contains spoiler information about the solution

• ###### Chrono79commented on "Highest Rank Number in an Array" kata

Note: no empty arrays will be given.

But you're generating an empty array.

And then there is another problem:

If there is a tie for most frequent number, return the largest number among them.

Your code returns the first value, not the largest one.

• ###### Pablo Vent commented on "Highest Rank Number in an Array" kata

This comment is hidden because it contains spoiler information about the solution

• ###### ejini战神created an issue for "Array Calculator" kata
• `assert.deepEqual` should be used

• Node 12. should be enabled

• ###### ӜЯℱӁℒᚹcreated an issue for "Highest Rank Number in an Array" kata

Ruby 3.0 should be enabled, see this to learn how to do it

Please organize the structure of test fixture as following (although it has been mentioned in the attached link, I'm repeated here again)

``````describe "<This message should describe the categories of test groups inside this block>" do
it "<A short message describing this test group>" do
expect(...).to eq(...) #Assertions
#Or Test.assert_equals(user_response, reference_response)
end
end
``````
• ###### magainiccommented on "Highest Rank Number in an Array" kata

func HighestRank(nums []int) int {
cache := make(map[int]int)
result, count := 0, 0
for _, key := range nums {
value, ok := cache[key]
if ok {
value = value + 1
} else {
value = 1
}
cache[key] = value

``````	if value > count {
count = value
result = key
}
}
return result
``````

}

• ###### akar-0created a suggestion for "Array Calculator" kata

The description should state that numbers in the array will always be integers.

• ###### Nischay created a suggestion for "Highest Rank Number in an Array" kata

A descending sorted dict takes care of all the test cases.

• ###### JohanWiltinkcommented on "Highest Rank Number in an Array" javascript solution

It's slightly worse even. Integer properties come first, sorted as numbers, then other properties, in insertion order. Integers have to be non-negative (!) and no leading or trailing anything. Because property names also are, of course, strings.

So JS won't sort an array of numbers as numbers, but it will sort an array of strings as numbers, if it is `Object.keys`.

It would seem better to just never ever ever rely on property name ordering. If it matters, sort it yourself explicitly, so future generations can see what ordering is actually in use.

• ###### Anh-Huynhcommented on "Highest Rank Number in an Array" javascript solution

I had the same question! I digged in and were able to find a very interesting behavior of an object numeric property - If we loop over an object that has integer properties, the properties are sorted (ascending). However, if the key are non-integers, then they are listed in the creation order. In this case, the last should be the largest integer that we want to return if there is a tie!