Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 498 characters in body
Source Link
pajonk
  • 19.4k
  • 5
  • 29
  • 78

R, 7568 bytes

f=function(D,C)"if"(all((utf8ToInt(paste(C))-48)%in%D),C,f(D,C+256))

Try it online!

Fails in TIO for larger test-cases.


without recursion:

R , 75 bytes

function(D,C){while(T%%256-C|any(!(utf8ToInt(paste(+T))-48)%in%D))T=T+1;+T}

Try it online!

R, 75 bytes

function(D,C){while(T%%256-C|any(!(utf8ToInt(paste(+T))-48)%in%D))T=T+1;+T}

Try it online!

R, 68 bytes

f=function(D,C)"if"(all((utf8ToInt(paste(C))-48)%in%D),C,f(D,C+256))

Try it online!

Fails in TIO for larger test-cases.


without recursion:

R , 75 bytes

function(D,C){while(T%%256-C|any(!(utf8ToInt(paste(+T))-48)%in%D))T=T+1;+T}

Try it online!

Source Link
pajonk
  • 19.4k
  • 5
  • 29
  • 78

R, 75 bytes

function(D,C){while(T%%256-C|any(!(utf8ToInt(paste(+T))-48)%in%D))T=T+1;+T}

Try it online!

AltStyle によって変換されたページ (->オリジナル) /