-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
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
lesson_1 #1259
base: master
Are you sure you want to change the base?
lesson_1 #1259
Conversation
""" | ||
lst_to_set = set(lst_obj) # !!! | ||
lst_to_set = set(lst_obj) # O(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
неверно, здесь линейная, посмотрите пример
for j in range(len(lst_obj)): # O(n^2) | ||
if lst_obj[j] in lst_obj[j+1:]: # O(n) | ||
return False # O(1) | ||
return True # O(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
выполнено
for i in range(len(lst_obj) - 1): # O(n) | ||
if lst_copy[i] == lst_copy[i+1]: # O(1) | ||
return False # O(1) | ||
return True # O(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
выполнено
|
||
def min_numb(numb): | ||
res = numb[8] #можно указать любое число, так как он перебирает весь список | ||
for i in numb: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ошибки стиля
|
||
#Быстрее вариант 1 : O(n) - проще и быстрее в данном примере (объёме). | ||
#Вариант 2 и уступает O(n) на небольших объёмах и при увеличении вводимых данных уступает варианту 3 | ||
#Вариант 3 O(n log n) масштабируемый и при бОльших объёмах будет одинакого оперативно выдавать результат |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
выполнено
print(pal_checker("Лёша на полке клопа нашёл")) | ||
print(pal_checker("Аргентина манит негра")) | ||
print(pal_checker('Молебен о коне Белом')) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
выполнено
No description provided.