Design a vending machine like coffee vending machine

Broadly, think about what objects are involved in a vending machine: VendingMachine - possibly an abstract class DrinkMachine, SnackMachine, and classes extending VendingMachine VendingProduct - an abstract class? Drink, other classes extending VendingProduct Coke, other classes extending Drink &c, &c. But I’m sure you can figure that out pretty easily. The nuts and bolts of the machine will take place in some kind of utility class, with methods to accept bills and coins, calculate change, etc. ...

First Missing Positive Problem

Problem Given an unsorted integer array, find the first missing positive integer. Follow up You have to find the smallest positive number missing from the array in O(n) time using constant extra space. You can modify the original array. Examples Example 1: Input: nums = [1,2,0] Output: 3 ...

This site uses cookies to improve your experience on our website. By using and continuing to navigate this website, you accept this. Privacy Policy