Given two lists and , check if they follow the same pattern or not.
Condition for pattern matching:
- > , then >
- = , then =
- < , then < ,
for all i, j.
2 17 100
10 20 50
5 7 10 33
10 50 10 45
To check if two lists follow the above pattern. Sort both lists and find the index of previous list element in the sorted list. If indices match, then pattern matched otherwise no pattern matched.
Code : Python program for checking the pattern.
- Python | Check if all elements in list follow a condition
- Python | Check if two lists are identical
- Python | Check if two lists have any element in common
- Python | Check whether two lists are circularly identical
- Python - How to Check if two lists are reverse equal
- Python | Check if two lists have at-least one element common
- Python | Check if element exists in list of lists
- Python - Frequency of x follow y in Number
- Python | Program to count number of lists in a list of lists
- Python | Check if a list exists in given list of lists
- Python | Zipping two lists of lists
- Python Lists
- Python | Iterating two lists at once
- Python | Dividing two lists
- Python - Lists Modulo
- Python | Average of two lists
- Python - Key Lists Summations
- Python - K Summation from Two lists
- Python | All possible permutations of N lists
- Python | Merge key value lists
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.