Skip to content

Commit ef23195

Browse files
committed
Small fixes
1 parent f17ce1b commit ef23195

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

data_structures/array/peak_element.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ def peak(arr, low, high):
66
n = len(arr)
77

88
while low <= high:
9-
mid = low + (high - low) / 2
10-
mid = int(mid)
9+
mid = (high - low) // 2
1110

1211
if (mid == 0 or arr[mid-1] <= arr[mid]) and (mid == n-1 or arr[mid+1] <= arr[mid]):
1312
return(arr[mid])

data_structures/array/square_of_sorted_array.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
"""
2+
Find the square of all the numbers of a sorted array such that after finding the square of the sorted array, the
3+
resultant array containing the squared numbers remains sorted
4+
"""
5+
16
def square(arr):
27
n = len(arr)
38
j = 0

0 commit comments

Comments
 (0)