Can someone explain question 13.9 in v1.5.3 with a concrete example?

#1

The question is “Find the smallest subarray sequentially covering all values”. Code is here: https://github.com/epibook/epibook.github.io/blob/master/solutions/java/src/main/java/com/epi/SubseqCover.java

0 Likes

#2

Hey Hemant,

We have an example of this question in the beginning of this problem, and let me paste that here with some additional explanations:

Assuming that you are given an article as follows:

My paramount object in this struggle is to save the Union, and is not either to save or to destroy slavery. If I could save the Union without freeing any slave I would do it, and if I could save it by freeing all the slaves I would do it; and if I could save it by freeing some and leaving others alone I would also do that.

Then you are searching for the shortest part in this article contains “Union” and “save” that appearing in this order (i.e., “Union” first then “save” second). Then your algorithm should return “Union, and is not either to save” this snippet as the answer.

Note that the difference between this problem and the one before (13.8) is that 13.8 does not asking the keywords can appear in any order.

Please let me know if you have any question on understanding this, and I would like to hear more about what bothers you to understand this such that we can improve the description for this problem.

1 Like