It reads integers from the standard input (until it gets a negative number) and puts them into an array. After that it calls processArray on the array, and then prints the value that is returned to standard output.
Currently, processArray does not do anything useful - it just returns 0.
we have to change processArray so that it finds the longest losing streak in the array, and returns the loss of the streak.
A sequence of consecutive numbers in which each number is less than or equal to the previous number is called a losing streak. The difference in value between the last number of the streak and the first number of the streak is known as the loss.
For example, if these numbers were provided on the standard input:
The losing streaks in this sequence are 36, 32, 32, and 121,66,24,22, and 661,6,4, and the corresponding losses are 4 and 99 and 657. In this case, the 2nd streak with 4 numbers is the longest, so your program should print it's loss:
we need to make sure that program prints a single integer to the standard output and nothing else. there should not be any Any unnecessary printf/println/putchar etc.
So How can we write program to resolve this issue?
You should know by now that we don't hand out solutions.
What have you tried? What are you stuck on?
posted 2 months ago
i tried below in python but in php 7 how to convert it ?
also it's giving these errors upon executing on python 3 platform:-
upon executing above program on python 3 platform getting below errors:-
Sorry. Your solution is incorrect. Please try again. Feedback for your solution:
The function does not work as expected. Please check the following carefully:
Please ensure that the program produces the expected output as given in the problem
Make sure your answer contains a full, working program.
Make sure your processArray function/method is returning the appropriate value
If you wrote a C program, make sure that the program is not using any functions not found in the standard C library. Specifically, it should not use any Microsoft or Turbo C specific functions like getch or clrscr or conio.h
Make sure that the program is not printing anything extra to the output
Make sure that the program is not trying to read any input. No scanf or getc