Back to Type Challenges

README

questions/04260-medium-nomiwase/README.md

latest1.7 KB
Original Source
<!--info-header-start--><h1>AllCombinations </h1><blockquote><p>by 蛭子屋双六 <a href="https://github.com/sugoroku-y" target="_blank">@sugoroku-y</a></p></blockquote><p><a href="https://tsch.js.org/4260/play" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.ja.md" target="_blank"></a> </p><!--info-header-end-->

Implement type AllCombinations<S> that return all combinations of strings which use characters from S at most once.

For example:

ts
type AllCombinations_ABC = AllCombinations<'ABC'>;
// should be '' | 'A' | 'B' | 'C' | 'AB' | 'AC' | 'BA' | 'BC' | 'CA' | 'CB' | 'ABC' | 'ACB' | 'BAC' | 'BCA' | 'CAB' | 'CBA'
<!--info-footer-start-->

<a href="../../README.md" target="_blank"></a> <a href="https://tsch.js.org/4260/answer" target="_blank"></a> <a href="https://tsch.js.org/4260/solutions" target="_blank"></a> <!--info-footer-end-->