Thursday, 7 October 2021

[Python] How To Find Largest Element In Array Solved

In this article we're about to work on Data structures and algorithm task.
The Task is to find the largest number from a given array, So without wasting anytime let's start

Given an array A[] of size n. The task is to find the largest element in it.

Example 1:
Input:
n = 5
A[] = {10, 5, 3, 54, 65}
Output:
65
Explanation:
The largest element of given array is 90.

Example 2:
Input:
n = 10
A[] = {10, 23, 12, 1, 2, 65, 89, 8, 5, 90}
Output:
90
Explanation:
The largest element of given array is 90.


Now we have Inputs as well to test our code so let's write the code and test both the examples one by one. Code Is Below



Now let's test the code for both examples

Example 1 Output:



Example 2 Output:

Checkout Data structures and Algorithm Books to Enhance Your Skill..

Labels: ,

0 Comments:

Post a Comment

If have any queries lemme know

Subscribe to Post Comments [Atom]

<< Home