Day 1/15 - Java Challenge Today's Problem : Find the Largest Element In The Array

Опубликовано: 29 Май 2026
на канале: mr raghav
2
0

As part of my 15 Days of Java challenge, I'm solving one problem a day to build consistency and deepen my problem-solving skills. Today's problem is simple but fundamental - it lays the groundwork for understanding array traversal, comparisons, and efficient looping

Approach:
1:- Initialize a variable max with the value of the first element in the array
2: Traverse the array using a loop
3:- During each iteration, compare the current element with the max
4:- If the current element is greater than max, update max.
5:- After the loop ends, max will hold the largest value

Algorithm in steps



Time Complexity : 0n
Space Complexity : 01


This approach is efficient because it only requires a single pass through the array