Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 3_Solution.sol #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ankit957173
Copy link

for index out of bound if index provided should be larger than array length and in require index should be smaller than array length

for index out of bound if index provided should be larger than array length and in require index should be smaller than array length
Copy link

@kanian kanian left a comment

Choose a reason for hiding this comment

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

It's

if (_index > arr.length - 1) {
            return;
        }

Let's say arr.length = 6; If you say _index > arr.length, you will get the case where _index = 6, which is clearly out of bounds, but with ( _index > arr.length ) == false;

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