Skip to content

Comments

Hwork2#2

Open
medvedevvu wants to merge 8 commits intomasterfrom
hwork2
Open

Hwork2#2
medvedevvu wants to merge 8 commits intomasterfrom
hwork2

Conversation

@medvedevvu
Copy link
Owner

No description provided.

func fiba(idx int) int {
fimap := map[int]int{0: 1, 1: 1}

switch idx {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мне кажется можно заменить простой проверкой на наличие

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И достает функция из мапы тольок первые 2 элемента. А дальше считает.

firstSlice := []int{1, 3, 11, 5, 6, 6, 7, 8, 9}
secondSlice := []int{0, 3, 11, 5, 6, 12, 7, 8, 9}
resmap := make(map[int]int)
firstSlice = append(firstSlice, secondSlice[:]...)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это - упоминается хотя бы в одном из них. А нужно в обоих(пересечение).


func main() {
var lText string = "спички топор молоток к веревка спички удочка молоток "
lTextarray := strings.Split(lText, " ")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вполне корректно. Но правильнее было взять функцию https://golang.org/src/strings/strings.go?s=8396:8426#L319

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants