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 18957

For challenges where an exact output is not required but some property must still be fulfilled.

2 votes

f(g(x)) decreases while g(f(x)) increases

Pyth, 34 Bytes This is just a direct translation of my Python answer. *-1*2%Q2+*2*QQ<Q0 *-1*2%Q2+*2*QQ>Q0
user1502040's user avatar
  • 3,864
20 votes

f(g(x)) decreases while g(f(x)) increases

Python, 68 characters f=lambda x:(1-x%2*2)*(2*x*x+(x<0)) g=lambda x:(1-x%2*2)*(2*x*x+(x>0)) f maps negative numbers to odd numbers and positive numbers to even numbers, and even numbers to positive n …
user1502040's user avatar
  • 3,864
1 vote

Generate a permutation from the high-water marks

Python 3, 64 bytes Uses zero-based indexing f=lambda m,n:sum(([*range(*t)][::-1]for t in zip(m,m[1:]+[n])),[])
user1502040's user avatar
  • 3,864
5 votes

Injectively saturate bit strings

Python, 51 bytes lambda n,k,s:sorted(set(range(n))-s)[-sum(s)%(n-k)] Attempt This Online! This is based on hyper-neutrino's answer to the 'three other numbers' challenge. Edit: I now believe I have p …
user1502040's user avatar
  • 3,864