1. Engineering
  2. Computer Science
  3. hi i working on a question but i cant seem...

Question: hi i working on a question but i cant seem...

Question details

Hi, I working on a question but I can't seem to get the test to pass. The instructions are down below. I have tried  attempting it 

/**

     * 

     * @param idx

     * @return true if a sub-array exists at given index (idx), false otherwise.

     * 

     * SOME EXAMPLES:

     * if idx = -1, return false since data[-1] is out of bounds

     * if idx = 0, return true since data[0] refers to the first sub-array

     * if idx = 1, return true since data[1] refers to the second sub-array

     * ...

     * if idx = data.length - 1, return true since data[data.length - 1] refers to the last sub-array

     * if idx = data.length, return false since data[data.length] is out of bounds

     */

   public boolean isValidSubsetIndex(int idx) {

   

    if(idx < 0 || idx > data.length - 1 ) {

    return true;

    }else {

    return false;

    } 

    }

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution