azamtoiri / Algorithms

Inconsistent return statements PYL-R1710
Style
Minor
a year agoa year old
Either all return statements in a function should return an expression, or none of them should.
16
17
18# recursive binary search
19def binary_recur(arr: list, start: int, end: int, target: int) -> int:  # use only with sorted array20    if end >= start:
21        mid = start + end - 1 // 2
22