Morgan Stanley
3.4 of 5 1,410 reviews
www.morganstanley.com New York, NY 5000+ Employees

Morgan Stanley Analyst Interview Question (student candidate)

I interviewed in New York, NY and was asked:
"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 [?]
Answer Flag Question

Part of a Analyst Interview Review - one of 914 Morgan Stanley Interview Reviews

Answers & Comments

0
of 0
votes
dynamic programming
- Interview Candidate on Sep 05, 2012 Flag Response
0
of 0
votes
(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)
- grim face on Sep 07, 2012 Flag Response

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.

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