diff --git a/16-slices/exercises/21-correct-the-lyric/main.go b/16-slices/exercises/21-correct-the-lyric/main.go index a1e5d2e..a2ad7c1 100644 --- a/16-slices/exercises/21-correct-the-lyric/main.go +++ b/16-slices/exercises/21-correct-the-lyric/main.go @@ -23,13 +23,23 @@ import ( // // STEPS // +// INITIAL SLICE: +// [all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay] +// +// // 1. Prepend "yesterday" to the `lyric` slice. // +// RESULT SHOULD BE: +// [yesterday all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay] +// +// // 2. Put the words to the correct positions in the `lyric` slice. // -// 3. Print the `lyric` slice. +// RESULT SHOULD BE: +// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday] // -// HINT: You don't need use the "yesterday" word from the `lyric` slice. +// +// 3. Print the `lyric` slice. // // // BONUS @@ -38,6 +48,22 @@ import ( // // + Check whether your conclusions are correct. // +// +// HINTS +// +// Only look at this if you get stuck. +// +// You can use the following slice operations to solve the exercise. +// +// + Prepends "value" to the slice: +// slice = append([]string{"value"}, slice...) +// +// + Appends some part (N to M) of the same slice to itself: +// slice = append(slice, slice[N:M]...) +// +// + Copies the last part of the slice starting from M to the first part of the slice until N: +// slice = append(slice[:N], slice[M:]...) +// // --------------------------------------------------------- func main() {