-
Notifications
You must be signed in to change notification settings - Fork 27
Elso hazi #14
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
base: master
Are you sure you want to change the base?
Elso hazi #14
Conversation
if tup[-1] == ending: | ||
res.append(tup) | ||
return res | ||
|
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.
wow :) Klassz megoldas, bar egy kicsit lassu. https://wiki.python.org/moin/HowTo/Sorting
key functions alatt talasz elegansabb megoldast.
basic/list2.py
Outdated
@@ -13,17 +13,15 @@ | |||
# so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or | |||
# modify the passed in list. | |||
def remove_adjacent(nums): | |||
# +++your code here+++ | |||
return | |||
return list(set(nums)) |
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.
haat... nem egeszen. mit gondolsz jo eredmenyt kapnal mondjuk [1,2,3,3,1] listara?
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.
Ja igen elnéztem, azt hittem csak simán halmazként kell visszaadni. Javítom majd:)
basic/list2.py
Outdated
|
||
|
||
# E. Given two lists sorted in increasing order, create and return a merged | ||
# list of all the elements in sorted order. You may modify the passed in lists. | ||
# Ideally, the solution should work in "linear" time, making a single | ||
# pass of both lists. | ||
def linear_merge(list1, list2): | ||
# +++your code here+++ | ||
return | ||
return sorted(list1 + list2) |
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.
nem rossz probalkozas, de a python sorted TimSort algoritmussal dolgozik nlogn idoben. A feladat leirasaban a megoldas; a ket lista eleve rendezett. ;)
No description provided.