- Given a list of items that has two attributes: one is the
idof current item and the other one is the
costof the item. You need to find out all the combinations(at least 2 items) whose total cost is less than or equal to an input value
- items: [(1, $20), (2, $30), (3, $50), (4, $40)]
- maxCost: $100
- return: [[1, 2, 3], [2, 3], [1, 3], [3, 4], [1, 2, 4], [2, 4], [1, 4], [1, 2]]
Solution(You can use DP as well):
- Given a map that maps an product(product ID) to its images. Since there are some images are being mapped by multiple products, the product information might be wrong. You need to de-duplicate these products who have the same images and remain only one lowest alphabet order ID.
- Returns: [A], as A has the same image with B and B also has a same image with C. Based on description, we have to remove B, C.
- Given a word like “apple” and an map that has one character to one character map indicating available character replacement. You need to return all possible string after replacing some character(at least one) in given word.
- word: “apple”
- Returns: [@pple, @ppl3, appl3, @pple]