Qualcomm Interview Question

Sort a 3-element array using only the min(a,b), max(a,b) functions Do not use the element you created, only the elements of the original array as parameters

Interview Answers

Anonymous

Jan 25, 2026

A[a,b,c] N[] N[0] = min(A[0], min(A[1], A[2])) N[1] = max(min(A[0], A[1]) , max(min(A[1],A[2]) , min(A[2], A[0]))) N[2] = max(A[0], max(A[1], A[2]))

Anonymous

Jul 20, 2026

Smallest Element (\(S_{1}\)): \(\min(a, \min(b, c))\)Largest Element (\(S_{3}\)): \(\max(a, \max(b, c))\)Middle Element (\(S_{2}\)): \(\max(\min(a, b), \min(\max(a, b), c))\)

Anonymous

Jul 20, 2026

Smallest Element (\(S_{1}\)): \(\min(a, \min(b, c))\)Largest Element (\(S_{3}\)): \(\max(a, \max(b, c))\)Middle Element (\(S_{2}\)): \(\max(\min(a, b), \min(\max(a, b), c))\)