Skip to content

Glossary: Coding Interviews in Go

Slice copy

Also written: slices.Clone

`slices.Clone(x)` makes a new slice with the same items, so changing or sorting the copy leaves the original alone. Backtracking saves a clone of `path`, because `path` itself is a view onto memory that later choices overwrite.

Where the book teaches it

Related terms

PathBacktracking