Do product managers know how to code? #softwareengineer #productmanagement #codingchallenge #python

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Using print hello, she a real one confirmed

jjn
Автор

scratch the whole code and write it from 0 😎 ez

jozkobranko
Автор

She did better by going step by step while debugging being a product manager

_greysama_
Автор

Low = mid + 1 else High = mid, in several cases the binary search It can be cycled, it’s best to have an approach either lower bound or uppee bound

sonnyakakitha
Автор

1)while (low <= high)
2)Return True
3) if (target> midValue: low= mid+1
4) else high= mid-1
Outside while return false

SwiftAndDroid
Автор

“Return target in list”

Python moment 😢

azophi
Автор

The moment she used a print to determine where the Issue starts I already knew she knows her stuff

aliendroid
Автор

I dont beliebe that this is a real product manager

freashty
Автор

Return False should be have one less space so it dont return false immediately when we do first try in the while loop.

kanishyathra
Автор

No problem with high = len(list), just depends on what your representation of the interval is.
Left is usually closed by convention, right can be closed or open:
len(list) -> is number in some index in [low, high[
len(list)-1 -> is number in some index in [low, high]
The updates are defined accordingly:
If mid<target: low = mid+1
Because we know that target is not in [low, mid] so we remove that interval.
If mid >target:
We know that target is not in [mid, high] or [mid, high[ (depending on choice of high) so we remove that interval and we get
[low, mid[ = [low, mid-1] and update high accordingly (high = mid if open on the right, high = mid-1 if closed)
Pretty simple to prove that if the element exists then it is always in the remaining interval and the size of the interval is strictly decreasing at each step so it always terminates

jurnygamer
Автор

The problem at the end is that the return False at the end is inside the loop, not outside, which is a bug.

Joe-kuko
Автор

low=mid+1, high=mid-1, and return false out of the while loop

akansha
Автор

Apparently the return false statement is put at the wrong place or so-called indentation😅

iprxvsj
Автор

im just asking but some of these errors can be found just by looking at the code and guessing what the result should be or am i wrong?

EggiBoi
Автор

In the else statement, was there any need to return false? Since the else takes care of it

cme
Автор

I forget to use Python since I switched to JavaScript, but I can say that I have no idea what the heck is she doing.

HikaruAkitsuki
Автор

A maybe Integer-Overflow bug: The line "mid = (low + high) // 2". By adding the integers first, they can overflow. A "mid = low + (high - low) // 2" is more robust and the integer is not overflowing.

amiganer
Автор

The return false is in the while loop smh...

robinpark
Автор

the way i saw it n first thing i realized is binary search is crazy. btw i dont even code

myst
Автор

Move return False statement out of while loop

isstylertho