greyireland / greyireland/algorithm-pattern

文章中有一处代码有缺陷

Ouverte
#41 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Go
Étoiles
15.5k
Forks
2.6k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

文件地址:algorithm-pattern/introduction/quickstart.md

问题strStr,问题代码:

```
func strStr(haystack string, needle string) int {
if len(needle) == 0 {
return 0
}
....
}
```

如果子串长度为0的话返回0有歧义,误认为子串起始地址为0,我觉得改为负数之类的更好。

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Open algorithm-pattern/introduction/quickstart.md and inspect the strStr example. Check how an empty needle is defined by the surrounding explanation or referenced problem, then clarify the returned value so it cannot be mistaken for a valid starting index. Update the example and verify the documented behavior is unambiguous.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
go
Domaine
documentation
Type d'issue
Bug
Difficulté
1/5
Temps estimé
Moins d'une heure
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.