Given a word of length n and n five-sided dice with a character on each side. Find out if this word can be constructed by the set of given dice. Example 1 Input: word = "hello" dice = [[a, l, c, d, e], [a, b, c, d, e], [a, b, c, h, e], [a, b, c, d, o], [a, b, c, l, e]] Output: true Explanation: dice[2] + dice[1] + dice[0] + dice[4] + dice[3] Example 2 Input: word = "hello" dice = [[a, b, c, d, e], [a, b, c, d, e], [a, b, c, d, e], [a, b, c, d, e], [a, b, c, d, e]] Output: false Example 3 Input: word = "aaaa" dice = [[a, a, a, a, a], [b, b, b, b, b], [a, b, c, d, e], [a, b, c, d, e]] Output: false (a) Frame this problem as a network flow problem; Give a graph showing the nodes with sources and sinks and give a rationale for your formulation. (b) To implement this, what algorithm(s) would you use? What is the running time of the algorithm? Why does it work (You can use exchange arguments to provide a proof)
Given a word of length n and n five-sided dice with a character on each side. Find out if this word can be constructed by the set of given dice.
Example 1 Input: word = "hello" dice = [[a, l, c, d, e], [a, b, c, d, e], [a, b, c, h, e], [a, b, c, d, o], [a, b, c, l, e]]
Output: true
Explanation: dice[2] + dice[1] + dice[0] + dice[4] + dice[3]
Example 2 Input: word = "hello" dice = [[a, b, c, d, e], [a, b, c, d, e], [a, b, c, d, e], [a, b, c, d, e], [a, b, c, d, e]]
Output: false
Example 3 Input: word = "aaaa" dice = [[a, a, a, a, a], [b, b, b, b, b], [a, b, c, d, e], [a, b, c, d, e]]
Output: false
(a) Frame this problem as a network flow problem; Give a graph showing the nodes with sources and sinks and give a rationale for your formulation.
(b) To implement this, what
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)