title: Implementing a sliding window (java)
body: <p>I am fairly new to java (and programming overall) and have received the task to implement a Sliding Window object from start to finish. The skeleton code is as follows:</p>
  
  <pre><code>import java.util.Scanner;
  
  //implement class SlidingWindow
  
  class Main {
  
  // this is the test code for the judge, do not modify
  public static void main(String[] args) {
      Scanner scanner = new Scanner(System.in);
      int windowSize = scanner.nextInt();
      SlidingWindow window = new SlidingWindow(windowSize);
      while (scanner.hasNextInt())
      {
          int value = scanner.nextInt();
          window.Put(value);
          System.out.println("[" + window.Min() + " " + window.Max() + "]");
      }
      scanner.close();
  }
  </code></pre>
  
  <p>What needs to be done (and the ideas I have had so far towards solving it)</p>
  
  <ul>
  <li><p>Create a sliding window w that can be instantiated with a window size n:</p>
  
  <p>SlidingWindow w = New SlidingWindow(n) //This is what stumps me the most - is it a self-growing array? A linked list?</p></li>
  <li><p>An input method Put that accepts integer numbers and has no return value:</p>
  
  <p>public static void Put(int value){ // implementation will depend on SlidingWindow</p></li>
  <li><p>A Max and Min method to return the min and max of the most recent inputs. This I will just do by looking for the min and max. </p></li>
  <li><p>If the number of inputs exceeds the size of the window, the oldest element should be discarded. </p></li>
  </ul>
  
  <p>Sorry for the vagueness of the question - we never dealt with windows in class (I am a few weeks in to learning anything about coding) so I am truly stumped. I have looked around online for some resources but have not yet found anything suitable to help me. </p>
  
  <p>If you have any ideas or advice to offer on how to create SlidingWindow w, I think that will get me on the right track!</p>
  
  <p>Thanks in advance!</p>