java.lang.Object
g1201_1300.s1287_element_appearing_more_than_25_in_sorted_array.Solution

public class Solution extends Object
1287 - Element Appearing More Than 25% In Sorted Array.<p>Easy</p> <p>Given an integer array <strong>sorted</strong> in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time, return that integer.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> arr = [1,2,2,6,6,6,6,7,10]</p> <p><strong>Output:</strong> 6</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> arr = [1,1]</p> <p><strong>Output:</strong> 1</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= arr.length <= 10<sup>4</sup></code></li> <li><code>0 <= arr[i] <= 10<sup>5</sup></code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • findSpecialInteger

      public int findSpecialInteger(int[] arr)