Second smallest number entered
Second smallest number entered
- 4
Locked
Comments (12)
- Popular
- New
- Old
You must be signed in to leave a comment
Evgeniia Shabaeva
9 March 2024, 18:53
I don't feel the information we studied in this lesson is enough to do the third task (to find the second smallest number). I wonder if we should try anything extra here? Like turn the scanner input into an array and sort it... Someone give me a hint, please:).
0
Mattt321 Java Developer
19 March 2024, 14:10
You are going right direction. There might be many first, second, third numbers, etc. so can you optimize it so the second smallest number is aways in a certain position? :))
+1
Jesú
7 November 2023, 23:32
If the average number of attempts is 3.6, then I must be very dumb to solve this with 15 attempts.
0
Mattt321 Java Developer
19 March 2024, 13:53
Man, it is completely ok, everyone starting from scratch always needs lots of attempts to do seemingly simple stuff - it is how you learn nothing too simple unless you have done it 1000 times so don't worry! :)) I bet many people here are not newcomers to programming like I am not :) gl hf! :)
+1
sl33pr Backend Developer at Church of Jesus Chri
7 September 2023, 23:18
Maybe I don't understand the question. The input data matches the conditions described. The example in the conditions returns a 5. Mine does too, but fails that requirement. I don't even know what question to ask here!
+1
Henk Developer at Inovo
22 March 2023, 06:50
once again, vague requirements. What does "If several second smallest numbers are entered, then you need to display any one of them" mean ?
0
Mattt321 Java Developer
19 March 2024, 13:57
for example, you get 1 1 5 5 5 10 21, etc. so the second smallest number is 5 although it is not the second input but 3rd 4th, and 5th - what this Is trying to say is you need to show any of those 3rd 4th 5th numbers - number 5 but beware, it doesn't have to be second number input in the row. and you can display any single one of them
0
Alex Tor Software Developer
14 July 2022, 06:13
I almost give up on this task, why you guys don't post more examples of what is expected from the solution?
0
Alex Tor Software Developer
14 July 2022, 07:27
from the current test:
Be sure that the second smallest is displayed when you enter the numbers 2 2 1.
how am I supposed to know which output would be correct in this case?
Apparently, the JUDGE expects 2 as an output, but 2 is not a second less number, it's just a second number in a row, the second less number would be 1, but it seems JUDGE has its own logic.
0
Roman
18 July 2022, 05:43
This task has an input-output example with explanations in the comments:
+1
Mattt321 Java Developer
19 March 2024, 14:00
in your example, the smallest number is 1 which means the second smallest number is 2 . The third smallest number could be any higher etc :). hope it helps :)
0
Anonymous #10989168
4 May 2022, 16:11
The task does not specify what to display if all the entered numbers are equal
+1