Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 612151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:51:43+00:00 2026-05-13T17:51:43+00:00

Consider a two-dimensional grid (the usual lattice in the plane). For my purposes, a

  • 0

Consider a two-dimensional grid (the usual lattice in the plane). For my purposes, a pattern or arrangement is an assignment of the numbers 1 and 2 to some connected subset of the grid points. For example, the following shows three separate arrangements:

.......1.....1....
.222...2.....12...
.111...2.....2....
.222...22...12211.
.......1....11.1..

I say that a small pattern matches a large one if the small one can be rotated or reflected such that all of its numbers are smaller than the numbers in the larger one. For example, consider this pattern:

......
.1212.
....2.
......

It does NOT match the leftmost arrangement above because it can’t be rotated or reflected to fit in a 3×3 square. It DOES match the middle arrangement because it can be rotated and reflected to fit underneath. It does NOT, however, match the rightmost arrangement because however it is rotated or reflected to fit in the rightmost arrangement, the numbers are larger in the small pattern than the large arrangement. (If any of my examples are unclear or you need more information, just ask away in the comments area. Some clarifications in advance: the pattern can’t be stretched, and it can’t be rotated so it’s diagonal with respect to the grid. That means there are four rotations and four reflections total, each of which can be translated.)

I am wondering about the following questions:

  1. How can I quickly test if a small pattern matches a large arrangement?

  2. Suppose I have a lot of small patterns. Can I pre-process them somehow to quickly tell if at least one of them matches an arrangement?

I suppose it’d be cool if a solution solves a more general problem (like arbitrary numbers — not just 1 and 2 — or allowing disconnected shapes), but I really only care about the case above. Thanks.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:51:44+00:00Added an answer on May 13, 2026 at 5:51 pm

    2D convolution.
    (complexity is n*Log(n) where n in number of elements) and might be good for larger matrices.

    Make both matrices matching and non matching same size.

    Test for each number seperatly.
    Example – cheking number k
    In serchung matrix (bigger) set numbers >= k on 0 other values on 1
    In patteren matrix set values <= k on 1 other set on 0

    Where the result of convolution is 0 is hit and match

    Check for each rotation and reflexion (8 total)

    That mean that general comlexity is knlog(n) where k is number of numbers (in your case 2) and n number of elements of bigger matrix)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im looking for a highly performant way to crop a two dimensional array. Consider
I need assistance in simulating movement between 2 points in a plane. Consider two
Homework: Consider the two-dimensional array A: int A[][] = new int[200][200]; where A[0][0] is
Consider two tables: Transactions , with amounts in a foreign currency: Date Amount =========
Consider two methods on the controller CustomerController.cs : //URL to be http://mysite/Customer/ public ActionResult
Consider two dates 2010-03-18 22:30:45 and 2010-03-19 03:30:15 .... How to get the number
let's consider two views that use the same layout composed of: A left column
consider the two template functions below: template <typename T, typename A> T* create(A i)
Consider these two classes mapped to the same table. One is readonly via mutable=false.
Consider the two vectors: v= [1 2 3 4 5 6 7] a=['a' 'b'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.