Determine if a grid contains another gridCount the contiguous submatricesDetermine if land is fully enclosed by fencesDetermine if Strings are equalRecognizing Repetition in stringsIs it a pangram?Find the largest and the smallest number in an arrayFlatten the Array!Split a grid into a gridPrint a quine that contains the inputMaking Squared WordsCheck if a string is entirely made of the same substring

What happens if I accidentally leave an app running and click "Install Now" in Software Updater?

no sense/need/point

Is 'contemporary' ambiguous and if so is there a better word?

Constitutional limitation of criminalizing behavior in US law?

How to preserve a rare version of a book?

Motion-trail-like lines

Hostile Divisor Numbers

In linear regression why does regularisation penalise the parameter values as well?

Why would one crossvalidate the random state number?

Some Russian letters overlap the next line of text when used in drop caps

How to calculate rate of axial precession?

In Futurama, how many beings has Leela slept with?

Gerrymandering Puzzle - Rig the Election

What does にとり mean?

In "Avengers: Endgame", what does this name refer to?

Why is my arithmetic with a long long int behaving this way?

about academic proof-reading, what to do in this situation?

Counting the Number of Real Roots of A Polynomial

How do I allocate more memory to an app on Sheepshaver running Mac OS 9?

How can a hefty sand storm happen in a thin atmosphere like Martian?

Sheared off exhasut pipe: How to fix without a welder?

Dihedral group D4 composition with custom labels

Should homeowners insurance cover the cost of the home?

Sci-fi/fantasy book - ships on steel runners skating across ice sheets



Determine if a grid contains another grid


Count the contiguous submatricesDetermine if land is fully enclosed by fencesDetermine if Strings are equalRecognizing Repetition in stringsIs it a pangram?Find the largest and the smallest number in an arrayFlatten the Array!Split a grid into a gridPrint a quine that contains the inputMaking Squared WordsCheck if a string is entirely made of the same substring













3












$begingroup$


Challenge
Create a function takes in two 2-dimensional arrays of Characters (or Strings if the programming language does not have characters as a datatype) as inputs: a and b.



Your task is to determine if b contains a. If this is so, return true. Otherwise, return false.



Sample Test Cases



a:

123
456
789
b:

123
456
789


should return true.



a:

code
golf
b:

thisis
code!!
golf!!
ohyeah


should return true.



a:

abcd
efgh
ijkl
b:

abcdef
ghijkl
mnopqr


should return false.



Least bytes wins.










share|improve this question









New contributor




Hazard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$







  • 1




    $begingroup$
    Hi and welcome to codegolf! I edited your test cases to (hopefully) make them a bit more clear. Note that we have a sandbox for working on challenges before posting them to main. Good luck!
    $endgroup$
    – FryAmTheEggman
    5 hours ago






  • 1




    $begingroup$
    Also, may I take the first array as an array of strings and the second as a string separated by newlines, even though my language(C#) has a character type built in?
    $endgroup$
    – Embodiment of Ignorance
    4 hours ago










  • $begingroup$
    @Neil Test cases 2 and 3 are not square.
    $endgroup$
    – Robin Ryder
    4 hours ago






  • 1




    $begingroup$
    Could you add a truthy test case where a isn't on b's left edge and a falsey test case where each line of a appears in consecutive lines of b but with their left edges staggered?
    $endgroup$
    – Shaggy
    3 hours ago















3












$begingroup$


Challenge
Create a function takes in two 2-dimensional arrays of Characters (or Strings if the programming language does not have characters as a datatype) as inputs: a and b.



Your task is to determine if b contains a. If this is so, return true. Otherwise, return false.



Sample Test Cases



a:

123
456
789
b:

123
456
789


should return true.



a:

code
golf
b:

thisis
code!!
golf!!
ohyeah


should return true.



a:

abcd
efgh
ijkl
b:

abcdef
ghijkl
mnopqr


should return false.



Least bytes wins.










share|improve this question









New contributor




Hazard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$







  • 1




    $begingroup$
    Hi and welcome to codegolf! I edited your test cases to (hopefully) make them a bit more clear. Note that we have a sandbox for working on challenges before posting them to main. Good luck!
    $endgroup$
    – FryAmTheEggman
    5 hours ago






  • 1




    $begingroup$
    Also, may I take the first array as an array of strings and the second as a string separated by newlines, even though my language(C#) has a character type built in?
    $endgroup$
    – Embodiment of Ignorance
    4 hours ago










  • $begingroup$
    @Neil Test cases 2 and 3 are not square.
    $endgroup$
    – Robin Ryder
    4 hours ago






  • 1




    $begingroup$
    Could you add a truthy test case where a isn't on b's left edge and a falsey test case where each line of a appears in consecutive lines of b but with their left edges staggered?
    $endgroup$
    – Shaggy
    3 hours ago













3












3








3


1



$begingroup$


Challenge
Create a function takes in two 2-dimensional arrays of Characters (or Strings if the programming language does not have characters as a datatype) as inputs: a and b.



Your task is to determine if b contains a. If this is so, return true. Otherwise, return false.



Sample Test Cases



a:

123
456
789
b:

123
456
789


should return true.



a:

code
golf
b:

thisis
code!!
golf!!
ohyeah


should return true.



a:

abcd
efgh
ijkl
b:

abcdef
ghijkl
mnopqr


should return false.



Least bytes wins.










share|improve this question









New contributor




Hazard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




Challenge
Create a function takes in two 2-dimensional arrays of Characters (or Strings if the programming language does not have characters as a datatype) as inputs: a and b.



Your task is to determine if b contains a. If this is so, return true. Otherwise, return false.



Sample Test Cases



a:

123
456
789
b:

123
456
789


should return true.



a:

code
golf
b:

thisis
code!!
golf!!
ohyeah


should return true.



a:

abcd
efgh
ijkl
b:

abcdef
ghijkl
mnopqr


should return false.



Least bytes wins.







code-golf string grid subsequence array






share|improve this question









New contributor




Hazard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Hazard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 5 hours ago









FryAmTheEggman

14.8k32583




14.8k32583






New contributor




Hazard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 6 hours ago









HazardHazard

162




162




New contributor




Hazard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Hazard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Hazard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 1




    $begingroup$
    Hi and welcome to codegolf! I edited your test cases to (hopefully) make them a bit more clear. Note that we have a sandbox for working on challenges before posting them to main. Good luck!
    $endgroup$
    – FryAmTheEggman
    5 hours ago






  • 1




    $begingroup$
    Also, may I take the first array as an array of strings and the second as a string separated by newlines, even though my language(C#) has a character type built in?
    $endgroup$
    – Embodiment of Ignorance
    4 hours ago










  • $begingroup$
    @Neil Test cases 2 and 3 are not square.
    $endgroup$
    – Robin Ryder
    4 hours ago






  • 1




    $begingroup$
    Could you add a truthy test case where a isn't on b's left edge and a falsey test case where each line of a appears in consecutive lines of b but with their left edges staggered?
    $endgroup$
    – Shaggy
    3 hours ago












  • 1




    $begingroup$
    Hi and welcome to codegolf! I edited your test cases to (hopefully) make them a bit more clear. Note that we have a sandbox for working on challenges before posting them to main. Good luck!
    $endgroup$
    – FryAmTheEggman
    5 hours ago






  • 1




    $begingroup$
    Also, may I take the first array as an array of strings and the second as a string separated by newlines, even though my language(C#) has a character type built in?
    $endgroup$
    – Embodiment of Ignorance
    4 hours ago










  • $begingroup$
    @Neil Test cases 2 and 3 are not square.
    $endgroup$
    – Robin Ryder
    4 hours ago






  • 1




    $begingroup$
    Could you add a truthy test case where a isn't on b's left edge and a falsey test case where each line of a appears in consecutive lines of b but with their left edges staggered?
    $endgroup$
    – Shaggy
    3 hours ago







1




1




$begingroup$
Hi and welcome to codegolf! I edited your test cases to (hopefully) make them a bit more clear. Note that we have a sandbox for working on challenges before posting them to main. Good luck!
$endgroup$
– FryAmTheEggman
5 hours ago




$begingroup$
Hi and welcome to codegolf! I edited your test cases to (hopefully) make them a bit more clear. Note that we have a sandbox for working on challenges before posting them to main. Good luck!
$endgroup$
– FryAmTheEggman
5 hours ago




1




1




$begingroup$
Also, may I take the first array as an array of strings and the second as a string separated by newlines, even though my language(C#) has a character type built in?
$endgroup$
– Embodiment of Ignorance
4 hours ago




$begingroup$
Also, may I take the first array as an array of strings and the second as a string separated by newlines, even though my language(C#) has a character type built in?
$endgroup$
– Embodiment of Ignorance
4 hours ago












$begingroup$
@Neil Test cases 2 and 3 are not square.
$endgroup$
– Robin Ryder
4 hours ago




$begingroup$
@Neil Test cases 2 and 3 are not square.
$endgroup$
– Robin Ryder
4 hours ago




1




1




$begingroup$
Could you add a truthy test case where a isn't on b's left edge and a falsey test case where each line of a appears in consecutive lines of b but with their left edges staggered?
$endgroup$
– Shaggy
3 hours ago




$begingroup$
Could you add a truthy test case where a isn't on b's left edge and a falsey test case where each line of a appears in consecutive lines of b but with their left edges staggered?
$endgroup$
– Shaggy
3 hours ago










5 Answers
5






active

oldest

votes


















2












$begingroup$


Brachylog (v2), 4 bytes



ss


Try it online!



Most easily run as a full program, as usual for a decision-problem, with a specified as a command-line argument, b on standard input. The question asks for a function, and the program also works as a function, with b on the left, a on the right, and output via producing an exception if and only if the decision is false.



Explanation



ss
s a substring of rows of the left input
… assert rectangular; swap row and column operations
s a substring of <s>rows</s> columns of the above matrix
implicit assert that the result can be the right input


The "assert rectangular" is, obviously, pointless, as the question guarantees that already. The rest of the program does the grid-finding for us by identifying a substring of the rows and of the columns, i.e. a submatrix.



Meta-discussion



We've had a very similar question before; I'd expect most answers to one question to be modifiable into answers to the other. I think this is the neater version of it, though.






share|improve this answer











$endgroup$




















    1












    $begingroup$


    Python 2, 106 118 bytes





    lambda a,b,L=len:any(any(sum(A==B[j:j+L(A)]for A,B in zip(a,b[i:]))==L(a)for i in range(L(b)))for j in range(L(b[0])))


    Try it online!






    share|improve this answer











    $endgroup$












    • $begingroup$
      @Neil: Fixed now.
      $endgroup$
      – Chas Brown
      3 hours ago


















    0












    $begingroup$


    Python 2, 160 139 bytes





    a,b=input()
    l=len(b)+1
    p=len(b[0])+1
    print any(a==[d[s%p:n]for d in b][s/p:e]for s in range(l*p)for e in range(s/p,l)for n in range(s%p,p))


    Try it online!



    Generates all possible and compares them with 'a'. I did not assume for it to be square, as it was not stated. But that would make the code a bit smaller.



    Original code for understanding purposes:



    def f(a,b):
    col_len = len(b)+1
    row_len = len(b[0])+1
    for start_col in range(col_len):
    for start_row in range(row_len):
    for end_col in range(start_col, col_len):
    for end_row in range(start_row, row_len):
    t=list(map(lambda a:a[start_row:end_row],b))[start_col:end_col]
    #print(t, a)
    if t == a:
    return True
    return False


    Version that supports only squares (125 bytes):





    a,b=input()
    l=len(b)+1
    print any(a==[d[s%l:n]for d in b][s/l:e]for s in range(l*l)for e in range(s/l,l)for n in range(s%l,l))


    Try it online!






    share|improve this answer











    $endgroup$




















      0












      $begingroup$


      J, 21 bytes



      <@[(1 e.[:,=)$@[<;.3]


      Try it online!



      how




      • <@[ boxed left arg


      • $@[<;.3] all rectangles in the right arg with the same shape as the left arg

      • now pass those to things as the left and right arg to...


      • (1 e.[:,=) is 1 an element of e. the flatten of [:, the boolean matrix showing if the left arg equals any of the rectangles in the right arg.





      share|improve this answer









      $endgroup$




















        -1












        $begingroup$

        python 3, 50 bytes



        # assumes input formated like this
        a = ["123","456","789"]
        b = ["123","456","789"]


        f=lambda a,b:min(max(c in d for d in b)for c in a)


        edit: github with working testsuite






        share|improve this answer










        New contributor




        steviestickman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        $endgroup$












        • $begingroup$
          I don't think this actually works for anything... example
          $endgroup$
          – HyperNeutrino
          4 hours ago










        • $begingroup$
          @HyperNeutrino your example shows intended behavior, "123" is not in ["12","45"]. i added my git repo to my answer.
          $endgroup$
          – steviestickman
          4 hours ago











        • $begingroup$
          @HyperNeutrino I think you have inverted a and b. Example (I haven't checked other tests.)
          $endgroup$
          – Robin Ryder
          4 hours ago










        • $begingroup$
          Making the first array ascue is not checked Try it online!
          $endgroup$
          – Neil
          4 hours ago







        • 1




          $begingroup$
          @steviestickman Oh okay, sorry, I didn't notice the ordering. However, it does break for this.
          $endgroup$
          – HyperNeutrino
          4 hours ago











        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "200"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );






        Hazard is a new contributor. Be nice, and check out our Code of Conduct.









        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f185169%2fdetermine-if-a-grid-contains-another-grid%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        2












        $begingroup$


        Brachylog (v2), 4 bytes



        ss


        Try it online!



        Most easily run as a full program, as usual for a decision-problem, with a specified as a command-line argument, b on standard input. The question asks for a function, and the program also works as a function, with b on the left, a on the right, and output via producing an exception if and only if the decision is false.



        Explanation



        ss
        s a substring of rows of the left input
        … assert rectangular; swap row and column operations
        s a substring of <s>rows</s> columns of the above matrix
        implicit assert that the result can be the right input


        The "assert rectangular" is, obviously, pointless, as the question guarantees that already. The rest of the program does the grid-finding for us by identifying a substring of the rows and of the columns, i.e. a submatrix.



        Meta-discussion



        We've had a very similar question before; I'd expect most answers to one question to be modifiable into answers to the other. I think this is the neater version of it, though.






        share|improve this answer











        $endgroup$

















          2












          $begingroup$


          Brachylog (v2), 4 bytes



          ss


          Try it online!



          Most easily run as a full program, as usual for a decision-problem, with a specified as a command-line argument, b on standard input. The question asks for a function, and the program also works as a function, with b on the left, a on the right, and output via producing an exception if and only if the decision is false.



          Explanation



          ss
          s a substring of rows of the left input
          … assert rectangular; swap row and column operations
          s a substring of <s>rows</s> columns of the above matrix
          implicit assert that the result can be the right input


          The "assert rectangular" is, obviously, pointless, as the question guarantees that already. The rest of the program does the grid-finding for us by identifying a substring of the rows and of the columns, i.e. a submatrix.



          Meta-discussion



          We've had a very similar question before; I'd expect most answers to one question to be modifiable into answers to the other. I think this is the neater version of it, though.






          share|improve this answer











          $endgroup$















            2












            2








            2





            $begingroup$


            Brachylog (v2), 4 bytes



            ss


            Try it online!



            Most easily run as a full program, as usual for a decision-problem, with a specified as a command-line argument, b on standard input. The question asks for a function, and the program also works as a function, with b on the left, a on the right, and output via producing an exception if and only if the decision is false.



            Explanation



            ss
            s a substring of rows of the left input
            … assert rectangular; swap row and column operations
            s a substring of <s>rows</s> columns of the above matrix
            implicit assert that the result can be the right input


            The "assert rectangular" is, obviously, pointless, as the question guarantees that already. The rest of the program does the grid-finding for us by identifying a substring of the rows and of the columns, i.e. a submatrix.



            Meta-discussion



            We've had a very similar question before; I'd expect most answers to one question to be modifiable into answers to the other. I think this is the neater version of it, though.






            share|improve this answer











            $endgroup$




            Brachylog (v2), 4 bytes



            ss


            Try it online!



            Most easily run as a full program, as usual for a decision-problem, with a specified as a command-line argument, b on standard input. The question asks for a function, and the program also works as a function, with b on the left, a on the right, and output via producing an exception if and only if the decision is false.



            Explanation



            ss
            s a substring of rows of the left input
            … assert rectangular; swap row and column operations
            s a substring of <s>rows</s> columns of the above matrix
            implicit assert that the result can be the right input


            The "assert rectangular" is, obviously, pointless, as the question guarantees that already. The rest of the program does the grid-finding for us by identifying a substring of the rows and of the columns, i.e. a submatrix.



            Meta-discussion



            We've had a very similar question before; I'd expect most answers to one question to be modifiable into answers to the other. I think this is the neater version of it, though.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 3 hours ago


























            community wiki





            2 revs
            ais523






















                1












                $begingroup$


                Python 2, 106 118 bytes





                lambda a,b,L=len:any(any(sum(A==B[j:j+L(A)]for A,B in zip(a,b[i:]))==L(a)for i in range(L(b)))for j in range(L(b[0])))


                Try it online!






                share|improve this answer











                $endgroup$












                • $begingroup$
                  @Neil: Fixed now.
                  $endgroup$
                  – Chas Brown
                  3 hours ago















                1












                $begingroup$


                Python 2, 106 118 bytes





                lambda a,b,L=len:any(any(sum(A==B[j:j+L(A)]for A,B in zip(a,b[i:]))==L(a)for i in range(L(b)))for j in range(L(b[0])))


                Try it online!






                share|improve this answer











                $endgroup$












                • $begingroup$
                  @Neil: Fixed now.
                  $endgroup$
                  – Chas Brown
                  3 hours ago













                1












                1








                1





                $begingroup$


                Python 2, 106 118 bytes





                lambda a,b,L=len:any(any(sum(A==B[j:j+L(A)]for A,B in zip(a,b[i:]))==L(a)for i in range(L(b)))for j in range(L(b[0])))


                Try it online!






                share|improve this answer











                $endgroup$




                Python 2, 106 118 bytes





                lambda a,b,L=len:any(any(sum(A==B[j:j+L(A)]for A,B in zip(a,b[i:]))==L(a)for i in range(L(b)))for j in range(L(b[0])))


                Try it online!







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 3 hours ago

























                answered 4 hours ago









                Chas BrownChas Brown

                5,3241523




                5,3241523











                • $begingroup$
                  @Neil: Fixed now.
                  $endgroup$
                  – Chas Brown
                  3 hours ago
















                • $begingroup$
                  @Neil: Fixed now.
                  $endgroup$
                  – Chas Brown
                  3 hours ago















                $begingroup$
                @Neil: Fixed now.
                $endgroup$
                – Chas Brown
                3 hours ago




                $begingroup$
                @Neil: Fixed now.
                $endgroup$
                – Chas Brown
                3 hours ago











                0












                $begingroup$


                Python 2, 160 139 bytes





                a,b=input()
                l=len(b)+1
                p=len(b[0])+1
                print any(a==[d[s%p:n]for d in b][s/p:e]for s in range(l*p)for e in range(s/p,l)for n in range(s%p,p))


                Try it online!



                Generates all possible and compares them with 'a'. I did not assume for it to be square, as it was not stated. But that would make the code a bit smaller.



                Original code for understanding purposes:



                def f(a,b):
                col_len = len(b)+1
                row_len = len(b[0])+1
                for start_col in range(col_len):
                for start_row in range(row_len):
                for end_col in range(start_col, col_len):
                for end_row in range(start_row, row_len):
                t=list(map(lambda a:a[start_row:end_row],b))[start_col:end_col]
                #print(t, a)
                if t == a:
                return True
                return False


                Version that supports only squares (125 bytes):





                a,b=input()
                l=len(b)+1
                print any(a==[d[s%l:n]for d in b][s/l:e]for s in range(l*l)for e in range(s/l,l)for n in range(s%l,l))


                Try it online!






                share|improve this answer











                $endgroup$

















                  0












                  $begingroup$


                  Python 2, 160 139 bytes





                  a,b=input()
                  l=len(b)+1
                  p=len(b[0])+1
                  print any(a==[d[s%p:n]for d in b][s/p:e]for s in range(l*p)for e in range(s/p,l)for n in range(s%p,p))


                  Try it online!



                  Generates all possible and compares them with 'a'. I did not assume for it to be square, as it was not stated. But that would make the code a bit smaller.



                  Original code for understanding purposes:



                  def f(a,b):
                  col_len = len(b)+1
                  row_len = len(b[0])+1
                  for start_col in range(col_len):
                  for start_row in range(row_len):
                  for end_col in range(start_col, col_len):
                  for end_row in range(start_row, row_len):
                  t=list(map(lambda a:a[start_row:end_row],b))[start_col:end_col]
                  #print(t, a)
                  if t == a:
                  return True
                  return False


                  Version that supports only squares (125 bytes):





                  a,b=input()
                  l=len(b)+1
                  print any(a==[d[s%l:n]for d in b][s/l:e]for s in range(l*l)for e in range(s/l,l)for n in range(s%l,l))


                  Try it online!






                  share|improve this answer











                  $endgroup$















                    0












                    0








                    0





                    $begingroup$


                    Python 2, 160 139 bytes





                    a,b=input()
                    l=len(b)+1
                    p=len(b[0])+1
                    print any(a==[d[s%p:n]for d in b][s/p:e]for s in range(l*p)for e in range(s/p,l)for n in range(s%p,p))


                    Try it online!



                    Generates all possible and compares them with 'a'. I did not assume for it to be square, as it was not stated. But that would make the code a bit smaller.



                    Original code for understanding purposes:



                    def f(a,b):
                    col_len = len(b)+1
                    row_len = len(b[0])+1
                    for start_col in range(col_len):
                    for start_row in range(row_len):
                    for end_col in range(start_col, col_len):
                    for end_row in range(start_row, row_len):
                    t=list(map(lambda a:a[start_row:end_row],b))[start_col:end_col]
                    #print(t, a)
                    if t == a:
                    return True
                    return False


                    Version that supports only squares (125 bytes):





                    a,b=input()
                    l=len(b)+1
                    print any(a==[d[s%l:n]for d in b][s/l:e]for s in range(l*l)for e in range(s/l,l)for n in range(s%l,l))


                    Try it online!






                    share|improve this answer











                    $endgroup$




                    Python 2, 160 139 bytes





                    a,b=input()
                    l=len(b)+1
                    p=len(b[0])+1
                    print any(a==[d[s%p:n]for d in b][s/p:e]for s in range(l*p)for e in range(s/p,l)for n in range(s%p,p))


                    Try it online!



                    Generates all possible and compares them with 'a'. I did not assume for it to be square, as it was not stated. But that would make the code a bit smaller.



                    Original code for understanding purposes:



                    def f(a,b):
                    col_len = len(b)+1
                    row_len = len(b[0])+1
                    for start_col in range(col_len):
                    for start_row in range(row_len):
                    for end_col in range(start_col, col_len):
                    for end_row in range(start_row, row_len):
                    t=list(map(lambda a:a[start_row:end_row],b))[start_col:end_col]
                    #print(t, a)
                    if t == a:
                    return True
                    return False


                    Version that supports only squares (125 bytes):





                    a,b=input()
                    l=len(b)+1
                    print any(a==[d[s%l:n]for d in b][s/l:e]for s in range(l*l)for e in range(s/l,l)for n in range(s%l,l))


                    Try it online!







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 4 hours ago

























                    answered 4 hours ago









                    NeilNeil

                    2,042324




                    2,042324





















                        0












                        $begingroup$


                        J, 21 bytes



                        <@[(1 e.[:,=)$@[<;.3]


                        Try it online!



                        how




                        • <@[ boxed left arg


                        • $@[<;.3] all rectangles in the right arg with the same shape as the left arg

                        • now pass those to things as the left and right arg to...


                        • (1 e.[:,=) is 1 an element of e. the flatten of [:, the boolean matrix showing if the left arg equals any of the rectangles in the right arg.





                        share|improve this answer









                        $endgroup$

















                          0












                          $begingroup$


                          J, 21 bytes



                          <@[(1 e.[:,=)$@[<;.3]


                          Try it online!



                          how




                          • <@[ boxed left arg


                          • $@[<;.3] all rectangles in the right arg with the same shape as the left arg

                          • now pass those to things as the left and right arg to...


                          • (1 e.[:,=) is 1 an element of e. the flatten of [:, the boolean matrix showing if the left arg equals any of the rectangles in the right arg.





                          share|improve this answer









                          $endgroup$















                            0












                            0








                            0





                            $begingroup$


                            J, 21 bytes



                            <@[(1 e.[:,=)$@[<;.3]


                            Try it online!



                            how




                            • <@[ boxed left arg


                            • $@[<;.3] all rectangles in the right arg with the same shape as the left arg

                            • now pass those to things as the left and right arg to...


                            • (1 e.[:,=) is 1 an element of e. the flatten of [:, the boolean matrix showing if the left arg equals any of the rectangles in the right arg.





                            share|improve this answer









                            $endgroup$




                            J, 21 bytes



                            <@[(1 e.[:,=)$@[<;.3]


                            Try it online!



                            how




                            • <@[ boxed left arg


                            • $@[<;.3] all rectangles in the right arg with the same shape as the left arg

                            • now pass those to things as the left and right arg to...


                            • (1 e.[:,=) is 1 an element of e. the flatten of [:, the boolean matrix showing if the left arg equals any of the rectangles in the right arg.






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 17 mins ago









                            JonahJonah

                            3,0981019




                            3,0981019





















                                -1












                                $begingroup$

                                python 3, 50 bytes



                                # assumes input formated like this
                                a = ["123","456","789"]
                                b = ["123","456","789"]


                                f=lambda a,b:min(max(c in d for d in b)for c in a)


                                edit: github with working testsuite






                                share|improve this answer










                                New contributor




                                steviestickman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.






                                $endgroup$












                                • $begingroup$
                                  I don't think this actually works for anything... example
                                  $endgroup$
                                  – HyperNeutrino
                                  4 hours ago










                                • $begingroup$
                                  @HyperNeutrino your example shows intended behavior, "123" is not in ["12","45"]. i added my git repo to my answer.
                                  $endgroup$
                                  – steviestickman
                                  4 hours ago











                                • $begingroup$
                                  @HyperNeutrino I think you have inverted a and b. Example (I haven't checked other tests.)
                                  $endgroup$
                                  – Robin Ryder
                                  4 hours ago










                                • $begingroup$
                                  Making the first array ascue is not checked Try it online!
                                  $endgroup$
                                  – Neil
                                  4 hours ago







                                • 1




                                  $begingroup$
                                  @steviestickman Oh okay, sorry, I didn't notice the ordering. However, it does break for this.
                                  $endgroup$
                                  – HyperNeutrino
                                  4 hours ago















                                -1












                                $begingroup$

                                python 3, 50 bytes



                                # assumes input formated like this
                                a = ["123","456","789"]
                                b = ["123","456","789"]


                                f=lambda a,b:min(max(c in d for d in b)for c in a)


                                edit: github with working testsuite






                                share|improve this answer










                                New contributor




                                steviestickman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.






                                $endgroup$












                                • $begingroup$
                                  I don't think this actually works for anything... example
                                  $endgroup$
                                  – HyperNeutrino
                                  4 hours ago










                                • $begingroup$
                                  @HyperNeutrino your example shows intended behavior, "123" is not in ["12","45"]. i added my git repo to my answer.
                                  $endgroup$
                                  – steviestickman
                                  4 hours ago











                                • $begingroup$
                                  @HyperNeutrino I think you have inverted a and b. Example (I haven't checked other tests.)
                                  $endgroup$
                                  – Robin Ryder
                                  4 hours ago










                                • $begingroup$
                                  Making the first array ascue is not checked Try it online!
                                  $endgroup$
                                  – Neil
                                  4 hours ago







                                • 1




                                  $begingroup$
                                  @steviestickman Oh okay, sorry, I didn't notice the ordering. However, it does break for this.
                                  $endgroup$
                                  – HyperNeutrino
                                  4 hours ago













                                -1












                                -1








                                -1





                                $begingroup$

                                python 3, 50 bytes



                                # assumes input formated like this
                                a = ["123","456","789"]
                                b = ["123","456","789"]


                                f=lambda a,b:min(max(c in d for d in b)for c in a)


                                edit: github with working testsuite






                                share|improve this answer










                                New contributor




                                steviestickman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.






                                $endgroup$



                                python 3, 50 bytes



                                # assumes input formated like this
                                a = ["123","456","789"]
                                b = ["123","456","789"]


                                f=lambda a,b:min(max(c in d for d in b)for c in a)


                                edit: github with working testsuite







                                share|improve this answer










                                New contributor




                                steviestickman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.









                                share|improve this answer



                                share|improve this answer








                                edited 4 hours ago





















                                New contributor




                                steviestickman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.









                                answered 4 hours ago









                                steviestickmansteviestickman

                                12




                                12




                                New contributor




                                steviestickman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.





                                New contributor





                                steviestickman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.






                                steviestickman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.











                                • $begingroup$
                                  I don't think this actually works for anything... example
                                  $endgroup$
                                  – HyperNeutrino
                                  4 hours ago










                                • $begingroup$
                                  @HyperNeutrino your example shows intended behavior, "123" is not in ["12","45"]. i added my git repo to my answer.
                                  $endgroup$
                                  – steviestickman
                                  4 hours ago











                                • $begingroup$
                                  @HyperNeutrino I think you have inverted a and b. Example (I haven't checked other tests.)
                                  $endgroup$
                                  – Robin Ryder
                                  4 hours ago










                                • $begingroup$
                                  Making the first array ascue is not checked Try it online!
                                  $endgroup$
                                  – Neil
                                  4 hours ago







                                • 1




                                  $begingroup$
                                  @steviestickman Oh okay, sorry, I didn't notice the ordering. However, it does break for this.
                                  $endgroup$
                                  – HyperNeutrino
                                  4 hours ago
















                                • $begingroup$
                                  I don't think this actually works for anything... example
                                  $endgroup$
                                  – HyperNeutrino
                                  4 hours ago










                                • $begingroup$
                                  @HyperNeutrino your example shows intended behavior, "123" is not in ["12","45"]. i added my git repo to my answer.
                                  $endgroup$
                                  – steviestickman
                                  4 hours ago











                                • $begingroup$
                                  @HyperNeutrino I think you have inverted a and b. Example (I haven't checked other tests.)
                                  $endgroup$
                                  – Robin Ryder
                                  4 hours ago










                                • $begingroup$
                                  Making the first array ascue is not checked Try it online!
                                  $endgroup$
                                  – Neil
                                  4 hours ago







                                • 1




                                  $begingroup$
                                  @steviestickman Oh okay, sorry, I didn't notice the ordering. However, it does break for this.
                                  $endgroup$
                                  – HyperNeutrino
                                  4 hours ago















                                $begingroup$
                                I don't think this actually works for anything... example
                                $endgroup$
                                – HyperNeutrino
                                4 hours ago




                                $begingroup$
                                I don't think this actually works for anything... example
                                $endgroup$
                                – HyperNeutrino
                                4 hours ago












                                $begingroup$
                                @HyperNeutrino your example shows intended behavior, "123" is not in ["12","45"]. i added my git repo to my answer.
                                $endgroup$
                                – steviestickman
                                4 hours ago





                                $begingroup$
                                @HyperNeutrino your example shows intended behavior, "123" is not in ["12","45"]. i added my git repo to my answer.
                                $endgroup$
                                – steviestickman
                                4 hours ago













                                $begingroup$
                                @HyperNeutrino I think you have inverted a and b. Example (I haven't checked other tests.)
                                $endgroup$
                                – Robin Ryder
                                4 hours ago




                                $begingroup$
                                @HyperNeutrino I think you have inverted a and b. Example (I haven't checked other tests.)
                                $endgroup$
                                – Robin Ryder
                                4 hours ago












                                $begingroup$
                                Making the first array ascue is not checked Try it online!
                                $endgroup$
                                – Neil
                                4 hours ago





                                $begingroup$
                                Making the first array ascue is not checked Try it online!
                                $endgroup$
                                – Neil
                                4 hours ago





                                1




                                1




                                $begingroup$
                                @steviestickman Oh okay, sorry, I didn't notice the ordering. However, it does break for this.
                                $endgroup$
                                – HyperNeutrino
                                4 hours ago




                                $begingroup$
                                @steviestickman Oh okay, sorry, I didn't notice the ordering. However, it does break for this.
                                $endgroup$
                                – HyperNeutrino
                                4 hours ago










                                Hazard is a new contributor. Be nice, and check out our Code of Conduct.









                                draft saved

                                draft discarded


















                                Hazard is a new contributor. Be nice, and check out our Code of Conduct.












                                Hazard is a new contributor. Be nice, and check out our Code of Conduct.











                                Hazard is a new contributor. Be nice, and check out our Code of Conduct.














                                If this is an answer to a challenge…



                                • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                  Explanations of your answer make it more interesting to read and are very much encouraged.


                                • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


                                More generally…



                                • …Please make sure to answer the question and provide sufficient detail.


                                • …Avoid asking for help, clarification or responding to other answers (use comments instead).




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f185169%2fdetermine-if-a-grid-contains-another-grid%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                                Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                                Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її