Computer Science, asked by sameerkhalid, 1 month ago

Suppose you are given a list of ten positive numbers. Write an algorithm to find out the maximum number in the list?

Answers

Answered by tarsam41gmailcom
0

Given an array of integers which is initially increasing and then decreasing, find the maximum value in the array.

Examples :

Input: arr[] = {8, 10, 20, 80, 100, 200, 400, 500, 3, 2, 1}

Output: 500

Input: arr[] = {1, 3, 50, 10, 9, 7, 6}

Output: 50

Corner case (No decreasing part)

Input: arr[] = {10, 20, 30, 40, 50}

Output: 50

Corner case (No increasing part)

Input: arr[] = {120, 100, 80, 20, 0}

Output: 120

Similar questions