CoddityTeam / movaicode

Concours mensuel du Pire Développeur de France
123 stars 10 forks source link

GO/ Vous avez remarqué que kayak sort en kayak après une reverse string ? #12

Closed Matthieu-Coddity closed 2 years ago

Matthieu-Coddity commented 4 years ago

Première proposition testable ici: https://play.golang.org/p/faImxdRQbW7

package main

import (
    "fmt"
)

func main() {
    fmt.Println(reverse("j'ai perdu"))
}

func reverse(a string) string{
    var d string
    b := make(map[int]rune)
    e := make(map[int]rune)

    for i, v := range a {
        b[i] = v
    }
    for i := len(b)-1; i>=0; i-- {
        e[len(b)-i] = b[i]
    }
    for i:=0; i <= len(e); i++ {
        d = d + string(e[i])
    }
    return d
}

still faster than python

chris-codd commented 4 years ago

Ca marche avec Tenet ?

mehdi-dalil commented 4 years ago

C'est ouf ca marche aussi avec mon nom !

louismarslen commented 3 years ago

Cher Matthieu, j'ai le plaisir et l'honneur de t'annoncer que tu n'as PAS gagné le concours MOVAI CODE. Ce qui fait de toi un EKSSELAN Codeur.

SPOILER : j'espère qu'on aura le plaisir de recevoir ta participation à l'episode 2 du MOVAI CODE (stay tuned).

Bravo toutefois pour ta belle contribution 😊

louismarslen commented 2 years ago

Je fais un peu de ménage dans les issues -> d'ailleurs go participer à l'édition 5