Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Code Golf

Return to Answer

[Edit removed during grace period]
Source Link
n1k9
  • 81
  • 6
added 42 characters in body
Source Link
n1k9
  • 81
  • 6

Python 3, (削除) 53 (削除ここまで) (削除) 50 (削除ここまで) 45(削除) 45 (削除ここまで) 44 bytes

f=lambda n:n and[n] ifand[n]if n<2else[f(n-1),f(n-2)]

Try it online! Try it online!

Thanks @Dominic van Essen save 3 bytes Save.

Save 5 bytes changing the first if condition with and.

Thanks @user save 1 byte.

Python 3, (削除) 53 (削除ここまで) (削除) 50 (削除ここまで) 45 bytes

f=lambda n:n and[n] if n<2else[f(n-1),f(n-2)]

Try it online!

Thanks @Dominic van Essen save 3 bytes Save 5 bytes changing the first if condition with and

Python 3, (削除) 53 (削除ここまで) (削除) 50 (削除ここまで) (削除) 45 (削除ここまで) 44 bytes

f=lambda n:n and[n]if n<2else[f(n-1),f(n-2)]

Try it online!

Thanks @Dominic van Essen save 3 bytes.

Save 5 bytes changing the first if condition with and.

Thanks @user save 1 byte.

impreved
Source Link
n1k9
  • 81
  • 6

Python 3, (削除) 53 (削除ここまで) 50(削除) 50 (削除ここまで) 45 bytes

f=lambda n:0ifn n<1else[n]ifand[n] if n<2else[f(n-1),f(n-2)]

Try it online! Try it online!

Thanks @Dominic van Essen save 3 bytes Save 5 bytes changing the first if condition with and

Python 3, (削除) 53 (削除ここまで) 50 bytes

f=lambda n:0if n<1else[n]if n<2else[f(n-1),f(n-2)]

Try it online!

Thanks @Dominic van Essen save 3 bytes

Python 3, (削除) 53 (削除ここまで) (削除) 50 (削除ここまで) 45 bytes

f=lambda n:n and[n] if n<2else[f(n-1),f(n-2)]

Try it online!

Thanks @Dominic van Essen save 3 bytes Save 5 bytes changing the first if condition with and

added 38 characters in body
Source Link
n1k9
  • 81
  • 6
Loading
added 38 characters in body
Source Link
n1k9
  • 81
  • 6
Loading
added 41 characters in body
Source Link
n1k9
  • 81
  • 6
Loading
added 41 characters in body
Source Link
n1k9
  • 81
  • 6
Loading
Source Link
n1k9
  • 81
  • 6
Loading

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