Handloom Pattern Validation
Handloom Pattern Validation
EasyArrays0% accepted
Meera is a master weaver in Varanasi creating handloom sarees. The weaving pattern is represented by color codes (1=red, 2=blue, 3=gold, etc). The pattern must have alternating colors for aesthetic appeal. She needs to verify if the designed pattern follows alternation rule.
Approach
Given array of color codes, check if no two consecutive elements are the same (alternating pattern).
Input
6
1 2 1 2 1 2
Output
valid
More Arrays problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards