Check if permutation of first N natural numbers exists having Bitwise AND of adjacent elements non | C # Program to implement the above approach ; Function to check if a permutation of first N natural numbers exist with Bitwise AND of adjacent elements not equal to 0 ; If n is a power of 2 ; Driver Code
using System ; class solution { static void check ( int n ) { if ( ( n & n - 1 ) != 0 ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } public static void Main ( String [ ] args ) { int n = 5 ; check ( n ) ; } }