Skip to content

Conversation

antonlinok
Copy link

No description provided.

Comment on lines +29 to +30
// time complexity = O(1)
// space complaxity = O(1)
Copy link

Choose a reason for hiding this comment

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

Не совсем. O(1) стоимость функции без рекурсивного вызова. Мы не проходили, как формально выводить асимптотическую сложность такой рекурсивной функции. Но сложность очень высокая. Можешь ли ты написать программу так, чтобы требовался только один рекурсивный вызов, а не два, как у тебя?

Comment on lines +26 to +28
{"case1", Input{[]int{8, 4, 1, 0, 5, 9, 3, 7, 2, 6}, 4}, 5},
{"case2", Input{[]int{9, 6, 1, 7, 5, 9, 6, 5, 2, 6}, 9}, 4},
{"case3", Input{[]int{9, 6, 1, 7, 5, 9, 6, 5, 2, 0}, 9}, 0},
Copy link

Choose a reason for hiding this comment

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

Please add more tests (not only given examples).

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