Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 99708a9

Browse files
add solution in Python for 1287_element_appearing_more_than_25_in_sorted_array.py
1 parent c392978 commit 99708a9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def findSpecialInteger(self, arr: List[int]) -> int:
2+
# Find 25 % of the given array's length
3+
quarter = len(arr) // 4
4+
# Find required element in the given array
5+
for i in range(len(arr)):
6+
if(arr[i] == arr[i + quarter]):
7+
return arr[i]
8+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /