Coding Problem : Outputs the minimum amount of currency denominations

As you know I’ve been brushing up on my algorithm problem solving. I’ve decided to switch gears a bit and get back into C++ rather than Java. I found this problem by Serge Lansiquot from his Udemy course called Learn C++ Programming by Making Games. I highly recommend you pick up this series if you want a fun an easy way of understanding some fundamental computer science.

Write a program that takes a a floating point number and outputs the minimum amount of currency denominations needed to make up that number. Eg. If the user input 45.78 then the output would be:

4 ten dollar bills
1 five dollar bills
0 two dollar bills
0 one dollar bills
3 twenty five cent pieces
0 ten cent pieces
0 five cent pieces
3 one cent pieces

I’ll be updating this post with my solution via a short screencast in the next day or so. I’d love for you guys to post your solutions in the comments below. Please feel free to link me to a github gist or a screencast of your own or if you want to keep it simple and snap a screenshot and post that.

About Matthew Wallace

The lowdown on Matthew Wallace:
I’ve been a  software engineer for more than a decade. The technologies and languages I specialize in are many. Problem solving is something I really enjoy.

Languages I work in: Swift, Objective-C, Actionscript, Java, Ruby, Python, C++, Javascript

Niche Technologies that I work in: Video streaming platforms using Wowza (Java), FMS, WebRTC. I also have done realtime alert and chat systems using the same technologies such as FMS, XMPP, and others.

I tend to work in three main areas. Desktop, Web, and Mobile application development.

What you will get out of this:
My website is meant to showcase things I’m working, things I’m learning or interested it and also if you are looking for a software engineer, you’ve come to the right place. Feel free to reach out. I’d love to hear about what you are working on and what need I can fill or problem I can help solve.

[contact-form][contact-field label=’Name’ type=’name’ required=’1’/][contact-field label=’Email’ type=’email’ required=’1’/][contact-field label=’Website’ type=’url’/][contact-field label=’Comment’ type=’textarea’ required=’1’/][/contact-form]