VOOZH about

URL: https://www.geeksforgeeks.org/dsa/find-max-struct-array/

⇱ Find max in struct array - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Find max in struct array

Last Updated : 2 May, 2026

Given a struct array of type Height, find max:

Question source :Microsoft Interview Experience Set 127 | (On-Campus for IDC)

struct Height{
int feet;
int inches;
}

Convert each height into a single comparable unit (inches) and track the maximum while traversing the array once.

  • Initialize mx with minimum value
  • Traverse each element in the array. Convert height, total = feet * 12 + inches
  • Compare with current maximum and update mx if greater value is found
  • Return max

Output
125
Comment
Article Tags:
Article Tags: