You are given a binary string s and an integer k. Your task is to determine if every possible binary code of length k appears as a substring within s. Return true if all such binary codes are present, otherwise return false.
You are given an integer array nums and two integers k and p. Your task is to count the number of distinct subarrays where there are at most k elements divisible by p. A subarray is defined as a contiguous part of the array, and two subarrays are considered distinct if they differ in either length or at least one element.
You are given a 0-indexed string array words. You need to determine the number of index pairs (i, j) such that i < j and the string at index i is both a prefix and a suffix of the string at index j. The function isPrefixAndSuffix(str1, str2) returns true if str1 is both a prefix and a suffix of str2, and false otherwise.