11661 - Prophetic dream   

Description

''In a prophetic dream(預知夢), you can see your future. It is difficult to determine whether a dream is prophetic because we can't confirm until the vision happens. Even then, we only heard of stories . There are so many other dreams that do not come true. Thus, prophetic dream may just be mere coincidences. ''

Whether the prophetic dream exists or not, there are many dramas and movies based on it. Recently, While you were sleeping, the famous 2017 Korean TV series starred by Lee Jong-suk and Bae Suzy is majorly featuring prophetic dreams. In the story, Suzy has prophetic dreams. One day, she had a dream about tomorrow lottery numbers. However, she didn't see the last number in her dream. She only remember that the last number is maximum in lots of other numbers in her dream. Thus, your mission is to help her find the maximum element in a given array with a given size of array. Since you're a professional software engineer, you must use recursion method to solve the problem (cannot use loops to solve).

 

You need to implement following function:

#include <stdio.h>
#include "function.h"
int maxElement(int arr[], int n)
{
    // Write your code here
}

Input

first line : array size N (0<N<20)

second line: N elements in array

Output

Maximum element in array

Sample Input  Download

Sample Output  Download

Partial Judge Code

11661.c

Partial Judge Header

11661.h

Tags




Discuss