+ 2

Code coach (I don't understand the sequence) "Missing Numbers". What logic should I use?

I think I don't understand the sequence in Code Coach "Missing Numbers". It says the first input is the length of the sequence, remaining inputs are the sequence with some numbers missing. Aim is to output the missing numbers separated by a space. Full code coach instructions are in my code comments. https://code.sololearn.com/crcO9sYc34oE/?ref=app

4th Feb 2022, 6:25 AM
HungryTradie
HungryTradie - avatar
4 odpowiedzi
+ 3
Test case 0 makes sense. The 5 numbers are ascending by +1 from 2. Answer is "3 6". Test case 1 seems like it should be the same idea, 4 numbers ascending from 6, answer should be "7 8" so why does code coach want 11? Test case 2 wants 5 numbers ascending from 2, so missing numbers should be "3 5 6" why does it also want 7 & 9, and why not 8? Have I misread the question/format? I thought that "ascending" may just mean positive increase, that the increment may not be +1, but the test case answers include the +1 increment answers....
4th Feb 2022, 7:04 AM
HungryTradie
HungryTradie - avatar
+ 3
G'day! I'm with you, the problem description makes little sense. If there is some sort of pattern here (I don't see it), then at least it should be explained better what the task is. I can't try it myself because I'm not pro, but I would just drop sololearn an email from their homepage or to feedback@sololearn.com.
4th Feb 2022, 8:50 AM
Schindlabua
Schindlabua - avatar
+ 2
I even thought I had missed a trick by not setting the end of the array to be '\0' but that is not required for int[]
4th Feb 2022, 8:52 AM
HungryTradie
HungryTradie - avatar
+ 1
Aim: You are given a list of whole numbers in ascending order. You need to find which numbers are missing in the sequence. Task: Create a program that takes in a list of numbers and outputs the missing numbers in the sequence separated by spaces. Input Format: The first input denotes the length of the list (N). The next N lines contain the list elements as integers. Output Format: A string containing a space-separated list of the missing numbers. Sample Input: (written horizontal, originally each on a separate line) 5 2 4 5 7 8 4 6 9 5 2 4 Sample Output: (written horizontal) 3 6 // test case 0 7 8 11 // test case 1 3 5 7 9 // test case 2
4th Feb 2022, 6:56 AM
HungryTradie
HungryTradie - avatar