It fails on the second statement you just said, I checked and it works when there are two numbers equally close to zero
Thatāll be my last hint, something is wrong in this line that forbid you to succeed the test with all negative. Hope youāll find it
I changed my code a little overall, can you take a second look if it isnāt much of a burden? Iāll only write the output code
Console.WriteLine(TEMPS[min_temp]);
I believe this should now work, but still I get the same error, I tried to delete the minus sign because I thought that was the problem as only the cases in which the answer is a negative number failed
Hello,
There is clearly a bug in the validation of this program, please correct the validation process for this problem!
Before saying statement like that, be sure to check your program. I resend my code and got 100% again, so nope, the validation isnāt an issue
x Result is correct with a simple data set: {7 5 9 1 4} -> 1 (500 pts)
x It works with -273 alone (250 pts)
x It works with 5526 alone (250 pts)
x It works when inputs contains only negative numbers: : {-15 -7 -9 -14 -12} -> -7 (250 pts)
There are the points that where not given on my solution, and if I take one of this inputs my program will output 0 as in the case of no temperature. Please correct me if Iām wrong
{-15 -7 -9 -14 -12} -> -7 means that you should output -7, i donāt really understand what you are saying?
But as I said, Iāve been resending my code and everything seems to work fine. Try checking your code again, maybe you didnāt handle when there is only one number?
Iām sorry but it seems iāve missed interpreted the requirements, I thought that when a single value is in the set the program should print 0, after your comment iāve read again and solved with 100%.
Glad i could help
Iām solving this problem in C, and took some time before finding out that the TEMPS array contains the temperature values in a string format, instead of the binary (int) format directly. It was my disattention, I should have realized that because of the type of the array (char, not int), lol. Anyway, maybe that could be mentioned somewhere in the statement, or commented in the code. Thanks!
All the temperatures are in character data type?
there seems to be an issue with the clojure code, Change it to this to get it working. I think its a new line issue. Its my first time coding clojure so it may be just me but printing TEMPS gives nothing while printing TEMPS2 gives a list.
(defn -main [& args]
(let [N (read)
TEMPS (read-line)
TEMPS2 (read-line)]
I managed to pass all the test cases, but not all of the validation. When I tried to hard-code all the validation cases, they all gave the correct output. My program should work. I think there is something wrong with the validation rules.
mine passed 100% so the validation should be correct. it might be that its too slow and times out
This one is not working for me using clojure because the call to (read-line) into the TEMPS value does not give me any data. Not able to proceed without any input.
I think itās part of the challenge, because the starting code in Python 3 has the same issue. I just modified it to account for the case of no temperatures given (N==0).
The default tests only accept absolute (positive signed integer) answers. The validation tests only accept the original temperatures, regardless of sign (makes more sense).
You could also except EOFerror
and print(0)
I believe this game has a few bugs for the Python version. I treated TEMPS as a list and iterated for each variable in said list. In my code the >/< comparisons gave the opposite value as what I asked for. Each variable in the list TEMPS is treated as a string so trying absolute value functions or +/- doesnāt work.
Have you tried to use the absolute value while iterating over your list?