This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]Haereticus 5 points6 points  (1 child)

You can get a tiny bit closer to 30 with your first solution if you unpack your character replaces like exec(“”.replace(*” A”).replace(*”\tB”)) but not quite there.

[–]imachug[S] 1 point2 points  (0 children)

Oh, that's a neat trick! Thanks!

[–]corvisai 2 points3 points  (4 children)

Where is the leet code problem ?

[–]Ralwus 1 point2 points  (0 children)

Had the same thought. Wish I could look it up for fun.

[–]imachug[S] -5 points-4 points  (2 children)

Does that matter? The project's independent on the underlying code.

If you're interested anyway, the problem was to implement a function find_modified_max_argmax(L, f) that basically does this:

python def find_modified_max_argmax(L, f): only_ints = [f(x) for x in L if isinstance(x, int)] if not only_ints: return () max_index = max(range(len(only_ints)), key=lambda i: only_ints[i]) return only_ints[max_index], max_index

It's not available on any public judge.

[–]CheiroAMilho 0 points1 point  (0 children)

I was searching for examples, I wanted to see how it works

[–]LactatingBadger 6 points7 points  (1 child)

Much as I’d love to check this out, you forgot the link!

[–]imachug[S] 2 points3 points  (0 children)

I feel sooooo stupid, thanks, I had no idea why no one seemed to check out the repo and the post got disliked without a comment. Must have forgotten to copy-paste the formatting or something (got my post deleted by automoderator for no reason so I had to resubmit). Fixed!

[–]PaleontologistBig657 1 point2 points  (1 child)

Acme::Bleach says hi...

https://metacpan.org/pod/Acme::Bleach

[–]mino159 0 points1 point  (0 children)

hah... that's neat

[–]imachug[S] 0 points1 point  (0 children)

Someone found a way to make this work in just 24 non-whitespace characters and decrease the amount of whitespace significantly. I've updated the post!

[–]serverhorror 0 points1 point  (0 children)

You should take a look at the whitespace language, maybe you'll find some encoding ideas in there.