Microsoft Interview Question: Given a number (e.g.: 427) fi... | Glassdoor

Interview Question

Software Developer Interview(Student Candidate) Redmond, WA

Given a number (e.g.: 427) find the largest possible number

  from its digits (e.g.: 742)
Answer

Interview Answer

1 Answer

1

Sorting digits in O(nlogn). Can be done faster in O(n) by keeping a map of the digits 0-9.

Interview Candidate on Nov 29, 2015

Add Answers or Comments

To comment on this, Sign In or Sign Up.