Work in HR or Recruiting?
Morgan Stanley
www.morganstanley.com New York, NY 5000+ Employees
Work in HR? Complete Your Profile

414 interview experiences Back to all Morgan Stanley Interview Questions & Reviews

Interview Question for Analyst at Morgan Stanley:
Sep 05, 2012

There are 3 types of coins. The values are 1, 2, 5, respectively. What's the algorithm to get the minimun number of coins if the sum of them is N?


Tags: technical, algorithm
Add Tags [?]

See more for this Morgan Stanley Analyst Interview

Helpful Question?  
Yes | No
Inappropriate?

Answers & Comments (2)

Sep 05, 2012

by Interview Candidate:

dynamic programming
Helpful Answer?  
Yes | No
Inappropriate?

Sep 07, 2012

by grim face:

(function foo(n){
    var coins = [1,2,5]
    var num = 0;
    while (coins.length){
        var coin = coins.pop()
        num+= Math.floor(n/coin);
        n=n%coin;
        if(!n) break;
    }
    console.log(num);
})(28)
Helpful Answer?  
Yes | No
Inappropriate?

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

Tags are like keywords, helping to categorise interview questions that have something in common.