#include <stdio.h> #include <stdint.h> uint8_t is_circular_match(uint16_t reg, uint16_t target) { // Your code here if(reg==target) return 1; uint8_t res= 0; int n=15; while(n!=0){ if(target & 0x8000){ target= target<<1; target |= 0x0001; } else { target= target<<1; target &= ~(0x0001); } if(reg==target) return 1; n--; } return res; } int main() { uint16_t reg, target; scanf("%hu %hu", ®, &target); printf("%hhu", is_circular_match(reg, target)); return 0; }
Test Cases
Test Results
Input
45056 11
Expected Output
1