« first day (4758 days earlier)      last day (65 days later) » 

1:00 AM
Sandbox posts last active a week ago: (untitled)
@Simd J, 4 bytes: +/-]
J does have outfix builtin but using it is longer: 1+/\.]
1:17 AM
A: Sandbox for Proposed Challenges

emanresu ARemove falsy rows and columns Your challenge is to, given a matrix of nonnegative integers, remove all rows and columns that contain a 0. For example, with this matrix: [[5, 3, 2, 4, 1], [3, 2, 0, 4, 7], [7, 1, 9, 8, 2], [3, 2, 1, 5, 7], [6, 4, 6, 1, 2], [9, 3, 2, 4, 0]] Columns 3 and 5, al...

I guess linear time doesn't add much because the most straightforward and golfy approach is linear anyway
2 hours later…
3:14 AM
A: Sandbox for Proposed Challenges

vengyTYPOGLYCEMIA What is Typoglycemia? The stated principle, that only the first and last letters of a word affect reading comprehensions, is an Internet meme called Typoglycemia. However, in this challenge we will run a minor variation. Typo Injection Rules For each sentence, errors will be injected...

5 hours later…
8:42 AM
@Bubbler nice!
@Bubbler it doesn't take much away is how I think of it :)
8:59 AM
@Simd Haskell, 13 bytes: map=<<(-).sum
pointfree.io is honestly just magic
9:20 AM
That does look magic!
How does that code work?
it's easier to understand the code before i plugged it into the magic machine: f l=map((sum l)-)l
basically take the sum of the input, make a function that subtracts its input from that sum (currying), and map it over the input
Still very nice
What would do for max?
I mean instead of sum
CMC Given an array A of integers of length n, output for each i in 1...n (or 0...n-1) the max of all the integers in A except at index i. Your code should run in linear time
9:39 AM
I think I've golfed this before but I can't find the task
@Simd APL, 19 bytes: ⊂⌈⌿⍤⌿⍨¨↓⍤(∘.≠⍨)⍤⍳⍤≢
9:54 AM
you can't construct a n by n matrix since it takes at least quadratic time
I guess something could be done with where inverse? I don't know if that's linear though
10:41 AM
@Simd APL and J polyglot: +/-+
@Simd Are you sure that's doable? Don't you need to compare elements, making it n log n?
3 hours later…
1:21 PM
CMC Given a set of pairs of strings (table_name,column_name) find all columns that appear in every table
I have this so far: lambda v:functools.reduce(set.intersection,(a:={})or[a.setdefault(j,set()).add(i) for i,j in v]and a.values())
@Adám finding the max is O(n) right? I think finding the top 2 is still O(n). Then you perform another O(n) pass over the array, replacing each element with the max unless it is the max in which case you replace it with the 2nd
@Neil Ah, I guess one could find the top 2 as a single pass.
1:36 PM
@Adám yeah, finding the top k of n is probably O(k log k n), but if k is a constant (2), then who cares?
Right, that's the point I was missing.
5 hours later…
6:25 PM
@Neil very nice
1 hour later…
7:36 PM
What did you call the ipython run start from the command line and is text only? I am trying to look up problems with it and it seems confused with juoyter notebook everywhere
8:05 PM
@Simd I believe this is a linear-time solution in tinylisp 2, 26 bytes: (\(L)(: S(a + L)(m(p - S)L
(That is, assuming that cons is constant time, which it may not be in the Python implementation because I'm inserting items into Python lists and I'm not sure if that's constant time or something else because I'm not exactly sure how Python's lists are implemented and... yeah, close enough.)
A golfier solution is 20 bytes: (\(L)(m(p -(a + L))L
But that's quadratic because it recomputes the sum every time it calls the mapped function.
8:49 PM
@DLosc that's cool
9:00 PM
@mousetail If I understand the challenge correctly... BQN, 30 bytes: (⋈⌜○(⍷⊏)⟜⌽⍉∘>)⊸(×˝∘∊/⊑∘⌽¨∘⊏∘⊣)
Get lists of unique table names and column names, take their cartesian product, substitute each pair for 1 if it appears in the input and 0 otherwise, fold on multiplication, keep the column names that correspond to 1s in that result.
Q: TYPOGLYCEMIA - Cna Yuo Raed Tihs?

vengyWhat is Typoglycemia? Typoglycemia is a term that refers to the phenomenon where readers are able to understand text even when the letters in the middle of words are jumbled, as long as the first and last letters of each word remain in their correct positions. For example, Cna Yuo Raed Tihs? How...

9:19 PM
I feel like that's a dupe
9:48 PM
close, but i dont it is
9:58 PM
Q: Print Goodbye World instead of Hello World

DevsmanMake a cat program, with a catch. The program must refuse under all circumstances to output "Hello World", instead outputting "Goodbye World", with matching spacing (but matching casing is not required). "Hello World" must never appear as a substring of the output, regardless of casing, not even ...


« first day (4758 days earlier)      last day (65 days later) »