We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
an example - solution for max sum subarray, chapter 2
best = 0 for i in arr: for j in arr: sum = 0 for k in arr: sum += k best = max(best, sum) print(best)
real code -
best = 0 for i in range(0,len(arr)): for j in range(0,len(arr)): sum = 0 for k i range(i,j): sum += k best = max(best, sum
print(best)
The text was updated successfully, but these errors were encountered:
incorrect binary search too - def binary_search(arr, elem, prim_index=0): mid = int(len(arr) / 2) mid_elem = arr[mid] if mid_elem == elem: return mid + prim_index if mid_elem > elem: return binary_search(arr[:mid], elem, prim_index) if mid_elem < elem: return binary_search(arr[mid:], elem, prim_index + mid)
absent - iterative method
Sorry, something went wrong.
Thanks for suggesting, could you raise a pr ?
No branches or pull requests
an example - solution for max sum subarray, chapter 2
O(n^3) solution
best = 0
for i in arr:
for j in arr:
sum = 0
for k in arr:
sum += k
best = max(best, sum)
print(best)
real code -
best = 0
for i in range(0,len(arr)):
for j in range(0,len(arr)):
sum = 0
for k i range(i,j):
sum += k
best = max(best, sum
print(best)
The text was updated successfully, but these errors were encountered: