22 de diciembre de 2017

Slice rotate

There is a good site with golang "slice tricks" and want to add the rotate of a square two dimensional slice. 

for i := 0; i < len(a); i++ {
   for j := i; j < len(a); j++ {
      a[j][i], a[i][j] = a[i][j], a[j][i]

No hay comentarios.:

Slices may behave strange

While doing an advent of code exercise I saw an strange bug:  in a [][]byte when I modified a point [3][10] it also was modified in [...