Temperature Code Golf puzzle discussion

Hello! My Perl solution has 46 characters in it and I was wondering how many of you, who have condensed the Perl solution to the same exact character count, have come to the same code.

Long story short, the command:
echo -n ‘mycode’ | md5sum
yelds 22ac70e8aecdb37848cbb481193e99bc on *NIX when run on my solution.

And to test that all is ok:
echo -n ‘mycode’ | wc -c
should output 46

Hello Rogerup! I found several ways to code the solution in C with scanf & printf using 71 characters, but this seems to be the limit… You found the solution with 70 characters. Will you reveal, is your solution still relying on scanf & printf ?

As I said. Without hacking, my limit is 71 characters too. The version with 70 characters is cheating with “system” command. I hope, some day, CodinGame prevent these solutions.
While this does not happen, we can post in this post our best results, using exclusively the commands of each language

Hello guys ! I know that this question has already be asked, but i don’t find the per language ranking… In the header of the leaderboard I only have the choice of the place (world, country, school…), and nothing else…

Edit : I have found. If anyone is searching too, you have to consult the leaderboard from the IDE. Sorry for the disturbance ! :slight_smile:

Some tips for Perl proper: there is no need for ‘split’ directive and no need for comparison operators.

I’m blocked at 93 characters in C. Can you give me some clue about how to do less ?

Variable declarations, logical and ternary operators.

Thank you! I found the solution for C with 68 chars using “system” and “bash” but decided not to sumbit it. Of course, the automatic validator could mark it as “not valid”, but I do not want to take chances of it being valid. I am not still sure how valid the “system cheats” are…

thanks !
36 66 temp.c

36.66°C in your house? :sweat:

My code is failing Validator 1 but passing all others, and it’s the same code I used to solve original puzzle…

Hello.

I joined yesterday codingame to learn groovy. Suddenly I got error h> owever I am sure that code is fine (i’ve checked in IDEA)

def l=[]
n = input.nextInt() // the number of temperatures to analyse
input.nextLine()
temps = input.nextLine() // the n temperatures expressed as integers ranging from -273 to 5526. Feel free to read the input differently.
l+=temps.toInteger()
println([l.findAll({it>0}).min(), l.findAll({it<0}).max()].max().abs())

What might be a problem?

What’s the error message?

There a lot of them. I’ve tried different piece of code. I don’t understand do I need to read values (temps = input.nextLine()) in loop like for(i=0i<n:i++) or not? But it doesn’t work in console, but works in IDEA Intellij. Probably I don’t understand the rules. Which is also possible. Must be value closest to 0.

Ok. I’ve finally found out how to read values from input :slight_smile: temps is String. Now it works except last test when temps is empty.
Elvis doesn;t work for some reason again :slight_smile:

Hello guys !

Does anyone of you have some tips in Ruby ? I’m currently at 71 chars and I’m stuck with this super annoying gets.split.map(&:to_i). Any suggestions for read input more efficiently ?

Thanks :slight_smile:

*$>
…split.min_by{|x|…

I don’t understand why my code which passes all the tests and scores 100% on the easy puzzle fails the first validator of the code golf puzzle.

Any tip for this validator ?

(same as @Inhies)

Obviously your code doesn’t work correctly.
Check other people’s solutions from easy puzzles section to get an idea what might be wrong with your code.

I finally found what was wrong with my solution (without having to check other solutions). Indeed the test “13 -11” would have failed with my previous code !