Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Okay, I think I have a simple solution.<br> I'm going to pretend A,B are strings of binary numbers only. </p> <pre><code>A= 011010101001001101 B= 010 </code></pre> <p>Apply an XNOR filter on A, with B. Result will be <strong>C</strong>.<br> Assume origin of B is at its center.<br> (<em>This means look for B in A. If you find a match, put a 1 in C to that location.</em>) </p> <pre><code>A= 011010101001001101 C= 000010101001000000 </code></pre> <p>Simply, C shows the locations of where A contains B.<br> You could remove all the characters in the locations shown by C, for example, and that would solve your problem. But it wouldn't be the optimum solution. </p> <p>But finding the optimum solution is easy.<br> Okay, now the problem is a lot simpler. I can explain it like these algorithm problems: </p> <ul> <li>C shows the locations of paintings. Each guard can protect a range of X( X=length(B)/2+1 ). Place the minimum number of guards such that all paintings are protected. </li> <li>Remove from C the minimum number of 1's. For each 1 removed, all 1's in a neighbourhood of lenth(B)/2+1 are removed as well. </li> </ul> <p>This is no new problem, and there are existing solutions to it. Apply one such solution.<br> And this will yield the following. <strong>D</strong> shows the locations of 1's removed:</p> <pre><code>C= 000010101001000000 D= 000000100001000000 </code></pre> <p>Count the number of 1's in D -> 2. This means You can remove 2 elements from A so B is not a substring of A.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload