# Tag Info

### Reconstruct a list from its prefixes

Python 3, 51 bytes lambda l,p=0:[-p+(p:=x)for x in sorted(map(sum,l))] Try it online! Take the sums of the input lists, sort them in increasing order, take ...
• 145k

### Find the largest sum such that no two elements are touching

Ruby, 46 38 bytes ->l{a=b=0;l.map{a,b=b,[a+_1,b].max};b} Attempt This Online! Runs in O(n). How? We need 2 accumulators. The first 2 steps will initialize them ...
• 22.1k

• 26.2k

### Compute how many are no larger than each item in an array

Python, $O(n \frac{\log n}{\log \log n})$ Uses the approach from the paper "Optimal Algorithms for List Indexing and Subset Rank". ...
• 10.6k

### What and where is the max?

Julia 1.0, 7 bytes findmax Try it online! Outputs (value, CartesianIndex(row_index, col_index)) (1-indexed)
• 6,515

### What and where is the max?

Python + Numpy, 48 bytes lambda x:(x.max(),divmod(x.argmax(),x.shape[1])) Attempt This Online!
• 897

### Is it a cartesian product?

Jelly, 9 bytes ŒṬ€SẸƇÆrE Try it online! Builds a 2D matrix where each element represents how many times its coordinates appear in the original array, and then ...
• 77k

### Transpose a multidimensional array

Python 3, 51 bytes f=lambda a,b:b<2and[*a]or[f(x,b-1)for x in zip(*a)] Try it online! Takes as input the list and then the dimension. If we look at the list of ...
• 10.6k

### Just another traffic jam!

Jelly, 3 bytes ŒgZ A full program that accepts a pair of the two strings as the first argument and prints the resulting single lane. Try it online! How? ...
• 107k

### "Perfect" an array

Vyxal 3, 16 bytes L:ɾẋΩᵛC₌}ƛ?ÞṅL}g Simple bruteforce, probably can be golfed more. Try it Online! ...
• 9,408

### Diagonalize a vector

Haskell, 39 bytes f[]=[];f(a:b)=(a:map(0*)b):map(0:)(f b) Recursively generates the matrix by appending a value at the top left corner of a smaller matrix.
• 251

### Find the largest sum such that no two elements are touching

R, 80 46 43 bytes Edit: hugely golfed with inspiration from G B's answer: upvote that! \(x)max(Reduce(\(a,i)c(max(a),a[1]+i),x,0)) Attempt This Online! Runs in ...
• 34.9k

### Output the longest list

Python, 74 74 bytes f=lambda i,n,m=0:1<len(r:={x(n)for x in i if x(m)})and f(i,n,m+1)or sum(r) Attempt This Online! Previous version had a bug Potentially ...
• 7,898

### Which skill to train?

APL(Dyalog Unicode), 14 bytes SBCS ⊃∘⍒(1+÷)*1+⍋∘⍋ Try it on APLgolf! ...
• 20.6k

### Remove falsy rows and columns

R, 35 bytes \(x,?=\(d)apply(x,d,all))x[?1,?2] Attempt This Online! Alternative solution if the input contained NAs instead ...
• 16.7k

### Search the deepest depths of an array

JCram, 13 bytes (SBCS) -1 thanks to @mukundan314 -1 thanks to @tsh A JCrammed version, as suggested by Kamila Szewczyk. νⓅιk⑦③⍋⍁lζ⁷⊗Ⓙ JavaScript (ES13), 60 bytes -...
• 193k

### Reconstruct a list from its prefixes

Jelly, 4 bytes §ṢŻI A monadic Link that accepts a list of lists of positive integers and yields a list of positive integers. Try it online! How? ...
• 107k

### Weave two lists, cycling if necessary

Vyxal, 9 bytes @÷›∴vẎƒYṪ Try it Online! ...
• 38.8k

### Is it a cartesian product?

Wolfram Language (Mathematica), 25 bytes MatrixRank@BinCounts@#<2& Try it online! Form a matrix whose entries correspond to the number of times a pair is ...
• 20.6k

### Longest Consecutive Sequence

Python 3, 45 bytes f=lambda l:len(l)and-~f({*l}&{x-1for x in l}) Try it online! Without using sets: Python, 48 bytes ...
• 145k

### Longest Consecutive Sequence

Haskell, 32 bytes f[]=0 f l=1+f[n|n<-l,elem(n+1)l] Try it online! Repeatedly filters l by only keeping elements ...
• 145k