Thanks a lot!
Bonjour. Je suis totalement dĂ©butant en code, et je nâarrive pas Ă rĂ©soudre ce problĂšme. Je pensais utliser la recherche dichotomique pour le rĂ©soudre aprĂšs avoir triĂ© la liste mais je suis perdu entre tous les programmes que je trouve sur le net. Je travaille sur Python. Pouvez vous mâaider ? Merci
Câest le puzzle oĂč il faut trouver la tempĂ©rature la plus proche de 0 ?
Poste ton script en privĂ©, on pourra tâaider.
so iâm using Rust: i get the smallest temp with using an if and comparing the read values against each other. For that i transform all temperature to a positive using the .abs() method. The problem i have now is that i am stuck and dont know how to display the coresponding negative number to my positive values
How about using an additional variable to store the corresponding negative number?
No need to use an array to solve this puzzle. It can be solved just comparing every input to the last result in the for-loop.
i need help it asks for a one then a negative five
and im using java
And itâll ask for different correct numbers (answers) for different tests and validators. Thatâs because your code must be general enough to solve all tests and validators.
The statement asks the output to be:
Display 0 (zero) if no temperatures are provided. Otherwise, display the temperature closest to 0.
With the following input, the closest to 0 is 1:
5
1 -2 -8 4 5
But if I change slightly the input, then the closest to 0 because -2:
4
-2 -8 4 5
So you need to find which one is closest to 0, whether itâs from the negative or positive side.
hello, I am having trouble with getting 100% on this coding game.
it states that I have done 100% on my test cases. However, when I go to submit it says that I didnât complete test cases 3 but I have.
Can you give me some help with this.
Many Thanks
Tests and validators are different. Your code may not be general enough to pass all the validator cases.
hello there,
I am learning Python
Canât get 100% with my code because of this validator that I donât understand
âTwo negative temperatures that are equal: {-10 -10}â
here is my solution
[Mod edit: Please avoid posting codes on the forum]
Can anyone give me a hint
The code youâve posted is incomplete. Anyway, please try to avoid posting codes on the forum.
What does your code output if the temperatures given are -10 and -10?
Itâs my first time doing a challange on this page. I dont understand how the console.log works. when i do i console.log() in the code, it wonât show on the console page on the left bottomâŠdo i have to click somewhere to run my code?
Have you clicked any PLAY button below your code?
Also, if you want to display anything other than the answer, you have to use console.error instead.
Si une seule valeur est envoyée, tu dois la retourner telle quelle.
Under python 3 the output expectations should be indeed clarified when it comes to values with matching absolute values.
[edit: code deleted after noticing Mod edits]
As i figured it out the result checking clearly favors positive values when it comes to matching absolute values. You need to add check where it checks wether the list contains an element thats absolute value would equal to the value closest to 0 then you need to return the one that is positive. (sorry for my english hope it makes sense)
Hi ! I tried this puzzle with C++ but I canât check if a string is sent to cin or if t is a digit⊠What if no value is sent to cin?
Youâre given the number of temperatures as the first input. If it is 0, then the next line will not contain any digits (temperatures).