Count of triplets in Binary String such that Bitwise AND of S[i], S[j] and S[j], S[k] are same
Given a binary string S of length N, consisting of 0s and 1s. The task is to count the number of triplet (i, j, k) such that S[i] & S[j] = S[j] & S[k], where 0 ⤠i ï¼ j ï¼ k ï¼ N and & denotes bitwise AND operator. Examples: Input: N = 4, S = â0010âOutput: 4 Explanation: Following are 4 tri