educative.io

Educative

String.Substring makes it harder to understand?

Why the code is written in such a problematic manner. There are so many easy solutions available for this one.
I dont understand why we need to bring the string.substring ()


Type your question above this line.

Course: https://www.educative.io/collection/5642554087309312/5679846214598656
Lesson: https://www.educative.io/collection/page/5642554087309312/5679846214598656/250001

@Siam_Hossain
Yes, there are a lot of easy solutions to tackle this problem, but we want the solution to be the most efficient. The substring function used will take the minimum time O(1) thus improving our time complexities.

1 Like