Skip to main content
deleted 241 characters in body
Source Link
hyperneutrino
  • 42.6k
  • 5
  • 68
  • 224

Jelly, 2 bytes1 byte

&Ṡ&

Try it online!Try it online!

I think I understood the challenge.

Explanation

&Ṡ  Main link
&   Bitwise AND; returns 0 if k at n is 0 and n otherwise
 Ṡ  Sign; 0 -> 0 and n -> 1

If output doesn't have to be consistent for truthy/falsy, then simply & works.Bitwise AND Builtin

Jelly, 2 bytes

&Ṡ

Try it online!

I think I understood the challenge.

Explanation

&Ṡ  Main link
&   Bitwise AND; returns 0 if k at n is 0 and n otherwise
 Ṡ  Sign; 0 -> 0 and n -> 1

If output doesn't have to be consistent for truthy/falsy, then simply & works.

Jelly, 1 byte

&

Try it online!

Bitwise AND Builtin

Source Link
hyperneutrino
  • 42.6k
  • 5
  • 68
  • 224

Jelly, 2 bytes

&Ṡ

Try it online!

I think I understood the challenge.

Explanation

&Ṡ  Main link
&   Bitwise AND; returns 0 if k at n is 0 and n otherwise
 Ṡ  Sign; 0 -> 0 and n -> 1

If output doesn't have to be consistent for truthy/falsy, then simply & works.