[Community Puzzle] Histogram - Puzzle discussion

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Ribak,validated by @DeanTheMachine,@vexilla72 and @Drunkey.
If you have any issues, feel free to ping them.

Hey, I might not be getting something in the problem here: “We only want the letters from A-Z and a-z”: ok but only A-Z to the Y axis right? so we’re counting an “a” and an “A” as 2 “a”'s right? We’re also flat out excluding anything that’s not [A-Za-z] right?

I’m asking as I did a frequency counter on the lorem ipsum, C is counted as 4.34 rounded up but there’s 16 out of 369 characters so: 4.33604336 and the error I’m getting is:
Found: ±±–+…
Expected: ±±-+

The only place I have the “found” string is before C, B is lower so C is what makes the length of that bar, so you’re expecting 3 to 4% for C and I’m not getting what I’m missing.

The tests are even worse I score 25% which makes me feel like I misunderstood what I’m supposed to do but can’t suss out what it is.

Any help would be gratefully received.

Yes, a and A are both counted for A and non-alpha char are excluded from total.

If B is 1% (rounded), C is 4% rounded and A an D is 0% rounded, then you need to print this (other part of histogram omitted):

  +-+
B | |1.xx%
  +-+--+
C |    |4.xx%
  +----+
D |0.00%
  +

Note: Your error message is not really helpful. Sometimes I find it better to (temporaily) print my solution to error stream so I can check and compare with the expected in full, and not stopping at the first mismatch.

1 Like

A post was merged into an existing topic: Code edition section not displayed nor editable

My code passes all tests but fails at submit number 4 (Lorem ipsum (2)).
I can’t find what is wrong.

Maybe need more data for testing.

If you want, you may send me your code in private message and I’ll take a look at what may have gone wrong.

Thank you 5DN1L for finding the case where it doesn’t work.
It was on the case where two consecutive values were < 0.5.

1 Like

I enjoyed finishing this with C language,
The hardest part was the graphical part and where to put “+” when two concecutive letters have different percentage.

Nice puzzle! The statement only misses one rounding specification in my opinion: ‘the nearest integer’ is ambiguous in the case of .5 (and was bugging me in test case 4). I learned something new today: Python rounds 6.5 down to 6 (while this contribution expects 6.5 to become 7). Bankers rounding apparently.