using System.Collections.Generic;
public static void Main()
FindMaxOR obj = new FindMaxOR();
public int[] arr = new int[] { 1, 4, 7, 3, 8, 7, 2 };
int[] bitArr = Enumerable.Repeat<int>(int.MaxValue, 32).ToArray();
for (int i = 0; i < arr.Length; i++) {
if (((arr[i] >> bit) & 1) == 1) {
currentOR = currentOR | arr[i];
if (maxItem <= currentOR) {
for (int j = 0; j <= maxBit; j++)
if (bitArr[j] < tempStart)
if (tempEnd - tempStart < end - start || maxItem < currentOR) {
Console.WriteLine(start + " " + end);