What if upper < nums[n-1]?

  • 0

    This problem does not indicate that upper should be less or equal than the last element in nums.
    I've tried a case as below:

    Your input

    Expected answer

    I think the correct answer should be ["2", "4"].
    It seems there is not such case in the test set.

  • 0

    Quite right to question it. The question should be worded better, but I think "where the range of elements are [lower, upper] inclusive" means that the input will always be bound by lower and upper. It probably should say something like "where the range of elements are in the inclusive range [lower, upper]".

  • 0

    @alexbowe Thanks, I have revised the description based on your comment.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.