Need a solution better than O(n^2) for an array related algorithm

  • 0

    I can only get O(n^2) solution for below question. Any better idea?

    Given an array of integers you to find the range l (the starting
    index) and r (the ending index) such that AND operation of largest two
    elements in that range is maximum. For example: Input 8 4 3 1 Output 2
    3 You have to print lexicographically smallest range.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.