12
Last seen 10 months ago
Member for 10 years, 1 month, 6 days
Difficulty Normal
I am 20 years old student of electronics in Poland.
Python begginer.
I'd like to put some light on mysterious t21 and t31 lists. For other reviewers wondering how does this work:
If we have two points (a,b) and (c,d), perpendicular direction to segment between this two points is ((a-b), (c-d)), which is basically a vector between these points. As it's only directi
More
umm
Cool that you've noticed that special case (I forgot about it), but shouldn't it be:
# Special case for one to keep the logic simpler (and zero, as an early out).
if number <= 1:
return 0 #zero here instead of number
Just a little notice, thanks for sharing this maginifi
More
Does this really work?
I thought that methods isdigit() islower() etc. return true only if whole string is made of digits or lower characters etc. That's why my solution looks how it looks.
More
Wow. It's so elegant... Now I see that I should have used lambdas for functions like det.
More
I feel like it ceases to be clear because of all the green comments...
More
Wow, nice!
dt = datetime.strptime(data[13:1:-1], '%S%M%H%d%m%y')
#20 line probably would be a little clearer with >>2 instead //4
Also I didn't know partial and base16 functions :D
More
Hey,
As far as the main idea should be algorythmically fast, I don't know how many structures in python work and what solutions do not add any complexity.
It would be nice to get some feedback about solutions I chose. For example I had no idea how to elegantly invert that route from end node.
More
PS: using the fact that the map is in carthesian coordinates one can try using A-star algorithm with meet in the middle, so it's not the fastest, but my solution is still pretty fast :P
More
PS:PS: Now I see I forgot to remove debug line 32: print(repr(present))
Also as I am commenting again, I'll cover quickly the main idea of algorithm for it to be easier to understand:
I am expanding my reachable positions from start to end and remembering how I got there via the string in tupl
More
Emm... now having seen the top solution I am ashamed for using binsearch :( it's an overkill, when one can simply once iterate through table >.<
It's still faster in those one-two letter solutions :P
More
Neat. TIL math.modf()
This one looks quite complicated maybe it would be more clear if you avoided using the same names for different roles (I mean "ps" here). Maybe it's unclear for me because I didn't get used to lambdas yet.
tuple(map(lambda ps: tuple(map(int, str.split(ps, ","))), str.
More
I noticed that you created your own main for tests. How do you use it in this interface? Just "Try it!" button runs it?
if __name__ == '__main__':
assert checkio('({(asda)sd[s]d})') == True, 'First'
assert checkio('({[a]((s)})') == False, 'Second'
print('All ok')
More
I decided for "Clear" cathegory, as I think that my variable and function names are quite informative (correct me if I'm wrong) and I don't like "Uncathegorised" group. Feels like we lack group "Shitty-but-I-don't-want-to-admit-it-group" I'd post there a lot :D
I am not even sure if it's pythonic
More
Nice binary search, I like it :)
Although I would again polem about the code being "clear", it is definetely "educational" :D
More
why buffer,input whyyyy
Neat trick, I didn't know this:
data = list(unhexlify(input.strip()))
More
Holy crap, this looks messy (lines 16-25). I would like to analyse this unless I had to... Maybe it's better to go for little wider but clearer solutions?
More
It's as clear as you can get :) Great solution.
I finally found a way to describe adjacent table with python:
adjacent = set(itertools.combinations([1,-1,0,1,-1],2))
What do you think?
More
Using deque surely simplifies a bit in the solution (in comparison to mine). By the way, do you know how fast deque operations of popping from front and appending at the end work?
More
Hi,
could you explain the "Speedy" category? I am certain that if it's a DFS it cannot be here (as it's definetely not fast), unless you mistook abbreviations and you meant a BFS.
Umm... after longer reading I am quite sure that it's a DFS.
It's definetely not a Speedy one... :(
More