Skip to main content
added 50 characters in body
Source Link
ovs
  • 61.3k
  • 3
  • 50
  • 164

Python 2, 39 3737 33 bytes

thanks to @Mr.Xcoder for -2 bytes

s=lambda f,k:s(f,f(k))if k-f(k)else k

Try it online!Try it online!

assumes the black-box function to be named f

Python 2, 39 37 bytes

thanks to @Mr.Xcoder for -2 bytes

s=lambda f,k:s(f,f(k))if k-f(k)else k

Try it online!

Python 2, 39 37 33 bytes

thanks to @Mr.Xcoder for -2 bytes

s=lambda k:s(f(k))if k-f(k)else k

Try it online!

assumes the black-box function to be named f

added 104 characters in body
Source Link
ovs
  • 61.3k
  • 3
  • 50
  • 164

Python 2, 3939 37 bytes

thanks to @Mr.Xcoder for -2 bytes

s=lambda f,k:k if k==f(k)else s(f,f(k))if k-f(k)else k

Try it online!Try it online!

Python 2, 39 bytes

s=lambda f,k:k if k==f(k)else s(f,f(k))

Try it online!

Python 2, 39 37 bytes

thanks to @Mr.Xcoder for -2 bytes

s=lambda f,k:s(f,f(k))if k-f(k)else k

Try it online!

Source Link
ovs
  • 61.3k
  • 3
  • 50
  • 164

Python 2, 39 bytes

s=lambda f,k:k if k==f(k)else s(f,f(k))

Try it online!