Skip to content

Conversation

@nikkuv
Copy link

@nikkuv nikkuv commented Jun 9, 2021

If the arr size is only one then It can give a segmentation fault. I encountered it while solving this problem.

If the arr size is only one then It can give a segmentation fault. I encountered it while solving this problem.

pair<int,int> subarraySort(vector<int> arr) {

if(arr.size() == 1) return 0;

Choose a reason for hiding this comment

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

return 0 will give an error I guess here since the return type is pair<int,int>

Copy link
Author

Choose a reason for hiding this comment

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

Yeah! You are right it should return {-1, -1} or (-1, -1) or something invalid pair I think.

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