New answers tagged

2 votes

Visible Dice Faces

Nekomata + -e, 4 bytes ᵒ+7f Attempt This Online! ...
  • 41.8k
2 votes

Visible Dice Faces

Vyxal, 4 bytes 7εF⁼ Try it Online! 7ε # 7 - each item F # Remove values that are in ^ ⁼ # Is it equal to the original?
4 votes

Visible Dice Faces

Cubically, 41 bytes $(7:*2-2!F-2!S-2!B'-2!B'-2!S-2!F$):0+>2=% Try it online! Takes input as a space-separated list of integers, printing ...
2 votes

Visible Dice Faces

TI-Basic, 26 bytes max(seq(min(7-I≠Ans),I,1,dim(Ans Takes input in Ans.
  • 2,760
2 votes

Visible Dice Faces

Desmos, 45 39 bytes f(x)=0^{[(7-i-x)^2.minfori=x.sort].min} Try it on Desmos!
  • 2,760
4 votes

Visible Dice Faces

Nibbles, 5.5 bytes (11 nibbles) -~+.$?@- 7 For each element x of input, checks tbat 7-x is ...
3 votes

Visible Dice Faces

Nibbles, 6 bytes -~,`&.$- 7$ Attempt This Online! Disgusting. Surely there is a better way to do this.
  • 6,323
4 votes

Is it a valid chemical?

Wolfram Language (Mathematica), 134 bytes Thanks to all for the motivation to immerse in graph theory! It is wonderful that there is a numerical criterion for connected multigraph. But I was wondering ...
  • 983
3 votes

Visible Dice Faces

Jelly, 4 bytes 7_ḟƑ Try it online! Relatively trivial golf of Erik's solution. ...
2 votes

Visible Dice Faces

C (GCC), 77 bytes i,j;r;f(v,l)int*v;{for(i=r=-1;++i<l;)for(j=0;j<l;)r*=v[i]+v[j++]-7;return r;} Try It Online! Explanation: ...
  • 441
3 votes

Is it a valid chemical?

Nekomata + -e, 13 bytes ∑2¦$ṁ±*$:#←c≥ Attempt This Online! A port of @Command Master's Python answer. The flag ...
  • 41.8k
7 votes

Visible Dice Faces

Regex (Perl / Java / PCRE2 v10.34+), 30 29 bytes ^(?!.*\b(x(\2?+,.*\b)?){7}\b) Try it online! - Perl Try it online! - Java Attempt This Online! - PCRE2 v10.40+ ...
  • 10.7k
1 vote

Is it a valid chemical?

Charcoal, 20 bytes ¬∨﹪Σ貋∧⌊θΣθ⊗⌈⊞Oθ⊖Lθ Try it online! Link is to verbose version of code. Outputs a Charcoal boolean, i.e. - ...
  • 156k
1 vote

Is it a valid chemical?

TI-Basic, 28 bytes max(dim(Ans)-1,max(Ans))≤min(Ans>0).5sum(Ans)not(fPart(.5sum(Ans Takes input in Ans. Uses the same method ...
  • 2,760
3 votes

Is it a valid chemical?

Arturo, 52 bytes $[a][s:∑a(0=s%2)∧(>=s/2max a)∧(-size a 2)<s/2] Thanks to S. L. Hakimi for solving the problem back in 1962 and @CommandMaster for finding ...
  • 16.7k
6 votes

Is it a valid chemical?

Jelly, 13 bytes Uses S. L. Hakimi's result as aired by Command Master in their excellent Python answer. ẠȧSH_L’»ṀƲeŻ$ A monadic Link that accepts a list of non-...
2 votes

Visible Dice Faces

Japt -!, 5 bytes ï+ ø7 Try it
  • 39.6k
6 votes

Is it a valid chemical?

R, 58 51 45 bytes Edit: -6 bytes thanks to pajonk \(x,`+`=sum)max(+x^0-1,x)<=all(x)*+x/2*!+x%%2 Attempt This Online! Based on xnor's comment on Command master's ...
4 votes

Is it a valid chemical?

Thunno D, \$ 21 \log_{256}(96) \approx \$ 17.29 bytes XDS2%!>xS2/xMxL1-ZPpP Attempt This Online! or verify all test cases ...
  • 9,146
3 votes

Is it a valid chemical?

05AB1E, 16 bytes OÉ›¦IO;IàIg<‚@«P Port of @CommandMaster's Python answer, so make sure to upvote him/her as well! Try it online or verify all test cases. ...
3 votes

Is it a valid chemical?

Vyxal, 17 bytes Based on Command Master's answer ∑₂?sṫ$∑≤?∑½?L‹≥WA ...
  • 7,457
5 votes

Is it a valid chemical?

JavaScript (ES6), 67 bytes Based on the theorem found by @CommandMaster. Returns 1 for falsy or 0 for truthy. ...
  • 179k
27 votes

Is it a valid chemical?

Python 3, 61 60 59 58 51 bytes lambda x:len(x)-2<~sum(x)%2*all(x)*sum(x)/2>=max(x) Try it online! -1 thanks to @Kevin Cruijssen -7 thanks to @xnor Uses ...
3 votes

Visible Dice Faces

Thunno D, \$ 5 \log_{256}(96) \approx \$ 4.12 bytes 7_cS! Attempt This Online! or verify all test cases Explanation ...
  • 9,146
4 votes

Visible Dice Faces

Thunno D, 7 \$5\log_{256}(96)\approx\$ 4.12 bytes 7_Gze Attempt This Online! ...
  • 1,557
1 vote

Is it a lobster number?

PowerShell Core, 126 bytes param($n)(($u=2..($n-1)|?{!($n%($a=$_)-or(2..($a-1)|?{!($a%$_)}))})|?{$n-match(("$_"|% t*y)-join'.*')}).Count-eq$u.count-and$u ...
  • 2,308
1 vote

Visible Dice Faces

jq, 25 bytes [.[] as $s|$s+.[]==7]|any Try it online! Generates all comparisons side + side == 7, and outputs ...
1 vote

Ragged list pattern matching, Part 2

Haskell, 89 bytes Assumption: ragged lists are defined in the following way: data RL a = L [RL a] | N a | W deriving Eq Solution: ...
  • 4,427
2 votes

Visible Dice Faces

Japt -x!, 5 bytes fUma7 Try it or verify test cases -1 byte thanks to Shaggy This is basically a port of Lyxal's Vyxal answer. <...
  • 1,557
1 vote

Is it traversable?

Ruby, 49 bytes ->s,h{h.none?{|w|h,=*h;s<h-w&&s-=s<=>0;s<-h+h=w}} Try it online!
  • 19.7k
3 votes

Visible Dice Faces

Vyxal, 4 bytes 7ε↔¬ Try it Online! Very simple answer, ports the approach of the 5 byte Jelly. Explained ...
  • 27.6k
2 votes

Is it traversable?

Jelly, 20 bytes ’¹¹?{ḷ<?N-N>? _Ɲçƒ<0 Takes a comma-separated list of integers on the left-hand side and the starting stamina on the right-hand side. ...
3 votes

Is it traversable?

Nekomata + -e, 16 bytes R↔$∆çJᵐ{CᵈAc}-0≥ Attempt This Online! This works in Nekomata v0.2.0.0, and uses some new built-ins. The ...
  • 41.8k
2 votes

Visible Dice Faces

Factor + sets.extras, 24 bytes [ 7 over n-v disjoint? ] Try it online! ...
  • 16.7k
1 vote

Is it traversable?

Charcoal, 29 bytes ¹≔§η⁰ζFη«≧⁻∧θ‹ι⁻ζθθ¿›ι⁺ζθ⎚≔ιζ Try it online! Link is to verbose version of code. Outputs a Charcoal boolean, i.e. ...
  • 156k
1 vote

Is it traversable?

Thunno, \$24\log_{256}(96)\approx\$ 19.75 bytes lXz[{YDyZA<?1-y1<xsTX}xP Attempt This Online! Port of Kevin Cruijssen's 05AB1E answer. Explanation ...
  • 9,146
6 votes

Is it traversable?

Haskell, 66 56 bytes With Joseph Sible-Reinstate Monica's suggestions: (doesn't change typing or behavior, except now it's a total function, which is a plus!) ...
2 votes

Is it traversable?

Python 3, 56 bytes f=lambda s,n,m=0,*t:m<1or(s>=m-n)&f(s-min(s,n-m>s),m,*t) Try it online! Takes the stamina as first argument and the splatted ...
  • 6,786
6 votes

Is it traversable?

R, 52 49 bytes \(s,t)any(Map(\(i)s<<-s-(-i>s)*!!s,d<-diff(t))<d) Attempt This Online! Outputs TRUE if the ...
4 votes

Is it traversable?

05AB1E, 15 bytes ¥vDyÄ‹i<y1‹ˆ]¯P Inputs in the order \$heights,stamina\$. Try it online or verify all test cases. Explanation: ...
10 votes

Is it traversable?

Excel (ms365), 75, 64 bytes -11 bytes thanks to @Dominic =REDUCE(B1,A2:A5-A1:A4,LAMBDA(a,b,IF(b>a,-1,a-(-b>a)*(a>0))))>=0
  • 2,663
4 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 ...
  • 8,625
1 vote

Guessing on straws

Vyxal, 17 bytes A vṅ÷:Ld1$(voÞṡḣ‟)₃ Input: nested array, output: 1(True), ...
  • 983
5 votes

Is it traversable?

PowerShell Core, 77 bytes param($s,$l)$args|?{if(($l-=$_)-ge0){$s-=+($l-gt$s)*!!$s}else{-$l-gt$s}$l=$_} Try it online! Passes the obstacle list using splatting. ...
  • 2,308
15 votes

Is it traversable?

JavaScript (ES6), 39 bytes Expects (stamina)(list). Returns false for truthy and true for falsy. ...
  • 179k
1 vote

Is it a super-prime?

Pyt, 5 bytes Đřᵽᵽ∈ Try it online! ...
3 votes

Detect round trips on a hyperbolic grid

05AB1E, 27 26 (or 23) bytes Ç<°JΔ•6o₁EAÛr£ð•3B2¡ι`:}õQ Port of AndrovT's top Vyxal answer, which in turn is a port of @Neil's Retina answer, which in turn is ...
4 votes

Detect round trips on a hyperbolic grid

Charcoal, 52 bytes ≔⭆SXχ⊕⌕LSRιθW⌊ΦE⪪”←“tU≧*h?λêQ✳x”¶⪪κ №θ⌈κ≔⪫⪪θ⌈ι⌊ιθ¬θ Try it online! Link is to verbose version of code. Outputs a Charcoal boolean, i.e. ...
  • 156k
9 votes

Detect round trips on a hyperbolic grid

Retina 0.8.2, 55 bytes \d $*RF FRRRFRRRF RFRFR FRFRF RRRFRRRFRRR }`FF|RRRR ^$ Try it online! Takes input as 123 but test suite ...
  • 156k
1 vote

Bubbler numbers

Vyxal, 11 bytes bṅÞS'3/≈;h≈ Try it Online! or get all the Bubbler numbers up to a given number. Port of Kevin Cruijssen's 05AB1E answer. Outputs \$0\$ for truthy ...
  • 9,146

Top 50 recent answers are included