title: Find odd numbers between a closed range
body: <p>I am doing a code challenge where given two integers l and r, I have to print all the odd numbers between i and r (i and r inclusive). The function must return an array of integers denoting the odd numbers between l and r.</p>
  
  <p>This is what I have so far</p>
  
  <pre><code> static List&lt;Integer&gt; oddNumbers(int l, int r) {
      List&lt;Integer&gt; list1 = new ArrayList&lt;&gt;();
      if ((r &gt; l) &amp;&amp; (l &gt;= 1) &amp;&amp; (r &lt;= 100000)) {
          for (int i = tmp; tmp &lt; r; i++) {
              if (l % 2 == 0)
                 l = l + 1;              
              list1.add(l);
              l = l + 2;
          }
      }
      return list1;
  }
  </code></pre>
  
  <p>However, I received several errors like this</p>
  
  <pre><code>Compiler Message
  Wrong Answer
  Your Output (stdout)
  Output hidden
  </code></pre>
  
  <p>Any ideas for this?
  on the QA of the challenge site, it seems related to Corner case problems.</p>