package main
func (_ Solution) GenerateDivTags(numberOfTags int) []string {
result := []string{}
var recursiveFunc func(string, int, int)
recursiveFunc = func(current string, open int, close int){
if open == numberOfTags && close == numberOfTags {
result = append(result, current)
return
}
if open < numberOfTags {
recursiveFunc(
current + "<div>",
open + 1,
close,
)
}
if close < open {
recursiveFunc(
current + "</div>",
open,
close + 1,
)
}
}
recursiveFunc("", 0, 0)
return result
}
Rekursiya boyicha masala ishlaymiz. Rekursiya haqida
Hali izoh yo'q. Birinchi bo'ling!