C#C
C#7mo ago
Bird 6

✅ Finding all possibilities of N length in an array

Hey so I have the Following code which basically iterate on all my tiles and create arrays of 3 of them, iterating on all possibilities
List<Tile[]> tiles = [];
for (int i = 0; i < matching.Length - 1; i++)
{
    for (int y = i + 1; y < matching.Length - 1; y++)
    {
        tiles.Add([tile, matching[i], matching[y]]);
    }
}
return tiles;


I'm trying to make this code generic so instead of arrays of 3, it can be array of N, but I'm not sure how to approche that

Could someone please help me with that?
Was this page helpful?