3.4 of 5 2,799 reviews Seattle, WA 5000+ Employees Software Engineer Intern Interview Question

"how to find the min and max in an array"
Add Tags [?]
Answer Flag Question

Part of a Software Engineer Intern Interview Review - one of 4,140 Interview Reviews

Answers & Comments

of 0
Find max: O(n)
max = arr[0];
i: 1->n-1
   if(max < arr[i])
      max = arr[i];

Find min: O(n)
min = arr[0];
i: 1->n-1
   if(min > arr[i])
      min = arr[i];
- Rohan on Mar 11, 2012 Flag Response

To comment on this question, Sign In with Facebook or Sign Up

Tags are like keywords that help categorize interview questions that have something in common.

Glassdoor is your free inside look at interview questions and advice. All interview reviews posted anonymously by employees and interview candidates.