You are given an integer array where every element appears exactly three times, except for one element which appears only once. Find the element that appears only once and return it. The solution must run in linear time complexity and use constant extra space.
Given two integers, left and right, representing a range [left, right], you need to calculate the bitwise AND of all numbers within that range, inclusive. The bitwise AND operation takes two numbers and returns a number where each bit is set to 1 if the corresponding bits of both numbers are also 1.