[Community Puzzle] Hill Notation and Hill Order

https://www.codingame.com/training/hard/hill-notation-and-hill-order

Send your feedback or ask for help here!

Hey there,

Quick question about ‘Hill Notation’ community puzzle:
Validators ‘Quantity Sort’ and ‘Bigger Sort’ fail on submit, but pass their test cases.

Anyone got some compounds to play around with? (I am not a chemist ;))

P.S.: It would be great if we could have dedicated forum sections for each community puzzle as soon it gets approved, thoughts?

1 Like

Maybe your sorting machine is wrong?

Pretty sure about that :wink:

Remember that you have to sort inside a component and the components themselves.

Try these tests:

1

2
C11H13NO
CCl4

Answer:

CCl4
C11H13NO

2

2
CH3CO2H
C2H4

Answer:

C2H4
C2H4O2

3

2
HCONH2
CH2F2O

Answer:

CH2F2O
CH3NO

4

2
C11H13NO
C2H4NO2

Answer:

C2H4NO2
C11H13NO

These exercise some of the relationships that I struggled a bit with on this puzzle. Hopefully you will gain some insight.

  • danBhentschel
2 Likes

Thanks, that will help!

Hi, I have the same problem. I past all test but fail in submit in validators ‘Quantity Sort’ and ‘Bigger Sort’.

I’ve tried examples of player_one and I pass that examples too.

Can anyone try this test?

3
C12H11O2
C12H11O3P5
C12H11O1P6

In my interpretation, (and apparently in original Hill text) C12H11O1P6 < C12H11O2 < C12H11O3P5 because first is alphabetically and if two compound have same atom, look for quantity.

I think the problem is in the line of puzzle: " If the elements are in the same order, the one with fewer of the element is sorted first." So, maybe the correct is: C12H11O2 < C12H11O1P6 < C12H11O3P5 because only look the quantity if there is exactly the same atoms names.

So, Can anyone test those compounds for me? and Can anyone provide some more tests?

Thanks

My output for this is:

C12H11OP6
C12H11O2
C12H11O3P5
  • danBhentschel

I don’t understand why is in IDE test case 02:
CCl4 < CHCl3

According to puzzle description:

Hill Order sorts elements in Hill Notation according to the following rules:

  • Compounds are sorted alphabetically by element. So Al2O3 comes before CH4.
  • If the elements are in the same order, the one with fewer of the element is sorted first.

3 < 4, so Cl3 < Cl4, so CCl3 < CCl4, so CCl3H < CCl4
H comes before Cl only in Hill Notation, but according to description Hill Order is fully alphabetical, as in the given example Al2O3 < CH4.

Why is the expected solution is CCl4 < CHCl3 and not CCl4 > CHCl3 ???

EDIT: now I get it. so the Hill Order is not alphabetical, but goes according to Hill Notation order. The given example Al2O3 < CH4 is just misleading. Could have been a nice puzzle. Such disambiguity in the description rendered it as a 1-star puzzle in my book… :frowning: