我正在运行一个Permute函数,但是我遇到类似这样的结果的问题,如何防止这种情况发生?在Permute函数中重复的问题
red|red|white
white|red|red
Public buffer As New List(Of String)
Public Sub Permute(ByVal Root As String, ByVal Depth As Integer, ByVal Buffer1 As List(Of String))
Dim data_array As String() = {"red", "blue", "white"}
For Each myStr As String In data_array
If Depth <= 1 Then
Buffer1.Add(Root & myStr)
Else
Permute(Root & myStr & ",", Depth - 1, Buffer1)
End If
Next
End Sub