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 whether two lists are circularly identical
- Python | Check if two lists have at-least one element common
- Python | Check if two lists have any element in common
- Python | Check if element exists in list of lists
- 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 | Union of Value Lists
- Python | Difference between two lists
- Python | Union of two or more Lists
- Python | Average of two lists
- Python | Merge key value lists
- Python | Dividing two 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.