Search Results
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 |
2
votes
lastIndexOf in CJam
Splitting is sometimes a good way to do this. E.g.
e# Stack: ... haystack needle
a/);S*,
With variants, such as removing the a if both needle and haystack are strings.
8
votes
Binary Images of Triangle Counts
CJam (56 55 53 chars) / GolfScript (64 chars)
CJam:
"P1"q~,>{_1&3*+_*24+48/}%_:e>2b,\2_$#f+2fbz(,@@:~~]N*
GolfScript:
"P1"\~,>{.1&3*+.*24+48/}%.$-1=2base,\{2.$? … Dissection
CJam GolfScript Explanation
"P1" "P1"\ NetPBM header
q~,> ~,> Create array [m .. n-1]
{_1&3*+_*24+ …
52
votes
Is this number a prime?
CJam, 4 bytes
qimp
CJam has a built-in operator for primality testing. …
4
votes
Accepted
Gimli, make it even shorter?
CJam (114 chars)
{24{[4/z{[8ZT].{8\#*G8#:Mmd+}__)2*\+.^W%\[_~;&8*\~@1$|2*@@&4*].^Mf%}%z([7TGT]R=4e!=\f=(2654435608R-_4%! … In CJam assigned names can only be single upper-case letters. There's space to append a comment e# Gimli in CJam and have characters left in a single tweet. …
4
votes
Shotgun Numbers
CJam, 24 bytes
l~__(,f-{_Imd!~)\#I*-}fI
Online demo
This is a port of my GolfScript answer, borrowing the loop from Martin's CJam answer and exploiting CJam's divmod operator. …
0
votes
Medieval orthography
CJam (89 88 bytes)
{32|_'`>\'{<*}:A;SqS++3ew{_1="jJuUvVs"#[-4_{_0=A! … 3*}_{_0=A3*}_{_)A\0='s=>268*}W]=~f^1=}%
Online demo
I never understood why CJam doesn't have regexes, but since it doesn't here's a solution which doesn't use them. …
8
votes
Randomly select from an array
CJam (9 bytes)
q~_]ze~mR
Online demo. This is a full program which takes input in CJam array format on stdin and prints the selected element to stdout. …
5
votes
Checking Word Grids
CJam (25 24 bytes)
q~e!{_z=},"True""False"?
Online demo. Pretty trivial apart from the specified output, because CJam doesn't have a Boolean type.
With thanks to Sp3000 for saving one stroke. …
2
votes
100 Prisoners and a light bulb
CJam (26 bytes)
100,1a*0-{{__100mr>!} …
5
votes
Find the reference angle
CJam (21 bytes)
180qd1$%z_@@-e<" deg"
Online demo …
3
votes
Generate the Abacaba sequence
CJam (14 bytes)
'aqi{'b+1$++}/
Online demo …
1
vote
Counting Eisenstein primes
CJam (34 bytes)
qi,:)_2m*{_:*\:-_*+}%\1>3%3*+:mp1b
Online demo …
3
votes
Block of digits
CJam (17 bytes)
A,:)_f{f*Bf%Af%N}
Online demo …
8
votes
Compute minimax of an array
CJam (11 bytes)
{ew::e>:e<}
Online demo …
20
votes
Determine the color of a chess square
CJam, 18 bytes
r:-)"lightdark"5/=
Online demo
Dissection
r e# Read a token of input
:- e# Fold -, giving the difference between the two codepoints
) e# Increment …