type-challenges-solutions
type-challenges-solutions copied to clipboard
type-challenges-solutions/en/medium-minusone
MinusOne
This project is aimed at helping you better understand how the type system works, writing your own utilities, or just having fun with the challenges.
https://ghaiklor.github.io/type-challenges-solutions/en/medium-minusone.html
Instead of appending a single element to the tuple on each recursive call, we can append more on each recursive call, which results in fewer recursive calls and passes the test. Check my solution for details: https://github.com/type-challenges/type-challenges/issues/10727
https://github.com/type-challenges/type-challenges/issues/18456#issue-1432554106
use Tail recursion
I wrote a short and long versions of solutions for this challenge with more explanation: https://github.com/type-challenges/type-challenges/issues/19437
中文笔记:https://juejin.cn/post/7167664060547203108/
Came up with two solutions. One works up to 9999
, the other works up to 9_007_199_254_740_992
.
https://github.com/type-challenges/type-challenges/issues/21030#issue-1509235310