Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 91213

A competition to solve a particular problem through the usage and manipulation of arrays.

34 votes
15 answers
2k views

In what order will the downloads complete?

Background Recently, I was installing updates on my pc with Pacman (I use arch btw) and noticed the order it downloaded files was like this Start with the largest 4 downloads When a download complete …
2 votes

Building Skyscrapers

Uiua, 43 chars ⊚↥⊃(≡(⨬(¬◿2/+|/↥⌕2|0)⊸⊡1)◫3↻1⊂0_0|↧◿2⇡⧻⤙=2) Pad Link
mousetail 'he-him''s user avatar
3 votes

Complement an infinite list

Python, 79 bytes lambda x,j=0:(i for i in count()if i-j or(j:=next(x))*0) from itertools import* Attempt This Online!
mousetail 'he-him''s user avatar
2 votes

Diagonalize a vector

><> (Fish), 53 bytes Hover over any symbol to see what it does Try it
mousetail 'he-him''s user avatar
13 votes
10 answers
1k views

Adjacent Items Sorting

Given a list, L, of sets of numbers like this: [[1], [0,2,3], [3,1], [1,2,3]] Output a single list of numbers such that 2 numbers A and B appear next to each other at least once if and only if B in L …
3 votes

"Signpost" puzzle from Tatham's collection

Python, 154 bytes lambda x:(z:=len(x))and next(i for i in permutations(range(z))if all(x[j]==i[j]or("RL"[j>i.index(i[j]+1)]==x[j])for j in range(z))) from itertools import* Attempt This Online! 0-ind …
mousetail 'he-him''s user avatar
30 votes
13 answers
3k views

Is it a valid chemical?

\$\newcommand{\tripow}[3]{ _{#1}{\stackrel{#2}{\triangle}}_{#3}} \tripow{O}{O}{O}\$ → \$\tripow{2}{2}{2}\$) [0] (Helium: He → 0) [3, 2, 1] (Nitroxyl: O=N-H → 2=3-1) [3, 3, 3, 3] (Tetrazete: \$\begin{array … }{ccccccc}N&-&N& &3&-&3\\\ ||& &||& → &||& &||\\\ N&-&N& &3&-&3\end{array}\$) [4, 1, 1, 1, 1, 2, 2, 2] [4, 2, 2, 1, 1] [3, 3, 2, 1, 1] Here are the Falsey/Truthy test cases as two lists of lists: [[1] …
4 votes
Accepted

Shortening this Code to process nested tuple even further without the use of max()

Python, 204 188 bytes -16 bytes thanks to @WheatWizard m=[*((input("Enter subject: "),int(input("Enter marks: ")))for _ in'*'*int(input("Enter number of tuples: ")))] print((*((i[:3].upper(),j)for i, …
Wheat Wizard's user avatar
  • 100k
5 votes

Is it traversable?

Rust, 90 bytes fn f(a:&[i32],b:i32)->bool{a.len()<2||a[1]-a[0]<=b&&f(&a[1..],b-(a[0]-a[1]>b&&b>0)as i32)} Attempt This Online! Recursive approach
mousetail 'he-him''s user avatar
17 votes
16 answers
740 views

Form a subset that is a continuous range

Given a list of lists of positive integers, output a subset of them so their union forms a continuous non-empty range with no numbers missing. For example, consider this input: [ [1, 2, 3, 5], [ …
0 votes

Find the largest sum of any contiguous subarray of the array

(@:$@:&: ;n~~/ Try it I thought Kadane's algorithm would always be longer but for ><>, which lacks normal array manipulation, it's actually shorter. Takes input as a length-prefixed array. …
mousetail 'he-him''s user avatar
4 votes

Find the largest sum of any contiguous subarray of the array

Python, 69 bytes lambda x:max(sum(x[a:b])for a in range(len(x))for b in range(len(x))) Attempt This Online! Python, 74 bytes Outputs the list lambda x:max((x[a:b]for a in range(len(x))for b in range( …
mousetail 'he-him''s user avatar
2 votes

Change the subject

Rust, 375 bytes |a:Vec<&str>|{let b=a.iter().map(|i|&i[..i.len()-1]).collect::<Vec::<_>>();f(&b.join(" "),b)};fn f(w:&str,p:Vec<&str>)->bool{p.len()<1||match p.iter().find(|k|{w.split(" ").collect::<H …
mousetail 'he-him''s user avatar
2 votes

Count the changes in an array

><> (Fish), 30 bytes i0\ ;n$\.13$\ 1+>i:0(?/:{=?^$ Try it
mousetail 'he-him''s user avatar
5 votes

Create \$n\$ sublists with the powers of two (1, 2, 4, 8, 16...)

><>, 47 bytes 1i:?v~~l?^; /$-1/ /on$o"[,": \2*$:}10./"]"o~60. Try it! Generates trailing commas at the end of lists, some languages allow that so that should be OK. Takes input as a char code. Uses …
mousetail 'he-him''s user avatar

15 30 50 per page