Thomson Reuters interview question

write an algorithm to build automatic cash and coin counting machine with minimal resources.