class Stack {
  /**
   * Represents a stack
   * @constructor
   * @param {Number=} capacity 
   */
  constructor(capacity = Infinity) {
    this.storage = [];
    this.capacity = capacity;
  }

  /** 
   * @description Check if stack is empty
   * 
   * Strategy: Use storage array length
   *
   * Time complexity: O(1)
   * Space complexity: O(1)
   *
   * @return {Boolean} - true if empty, or false otherwise
   */
  isEmpty() {
    return this.storage.length === 0;
  }

  /** 
   * @description Check if stack has reached capacity
   * 
   * Strategy: Check if storage array length matches capacity value
   *
   * Time complexity: O(1)
   * Space complexity: O(1)
   *
   * @return {Boolean} - true if full, or false otherwise
   */
  isFull() {
    return this.storage.length === this.capacity;
  }

  /**
   * @description View value at top of stack
   * 
   * Strategy: Look at storage array's final element using index
   *
   * Time complexity: O(1)
   * Space complexity: O(1)
   *
   * @return {*} - value at top of stack
   */
  peek() {
    return this.storage[this.storage.length - 1];
  }

  /**
   * @description Add input value to top of stack
   * 
   * Strategy: Use native Array push method if under capacity
   *
   * Time complexity: O(1)
   * Space complexity: O(1)
   *
   * @param {*} val - value added to stack
   * @return {Number} - size of stack after value inserted
   */
  push(val) {
    if (this.storage.length < this.capacity) { this.storage.push(val); }
    return this.storage.length;
  }

  /**
   * @description Remove value from top of stack
   * 
   * Strategy: Use native Array pop method
   *
   * Time complexity: O(1)
   * Space complexity: O(1)
   *
   * @return {*} - value removed from stack, or undefined if empty
   */
  pop() {
    return this.storage.pop();
  }

  /**
   * @description Check size of stack
   * 
   * Strategy: Use storage length
   *
   * Time complexity: O(1)
   * Space complexity: O(1)
   *
   * @return {Number} - total amount of items in stack
   */
  size() {
    return this.storage.length;
  }
}

module.exports = Stack;

@@ -32,24 +32,36 @@
 ents a stack
+ for numbers
 %0A   * @const
@@ -138,24 +138,54 @@
 Infinity) %7B%0A
+    this.maxes = %5B-Infinity%5D;%0A
     this.sto
@@ -226,24 +226,314 @@
 acity;%0A  %7D%0A%0A
+  /** %0A   * @description Check maximum in stack%0A   * %0A   * Strategy: Return last value added to maxes array%0A   *%0A   * Time complexity: O(1)%0A   * Space complexity: O(1)%0A   *%0A   * @return %7BNumber%7D - maximum value in stack%0A   */%0A  getMax() %7B%0A    return this.maxes%5Bthis.maxes.length - 1%5D;%0A  %7D%0A%0A
   /** %0A   * 
@@ -1553,24 +1553,90 @@
 der capacity
+. If value is%0A   * greater than previous max, make it the maximum.
 %0A   *%0A   * T
@@ -1857,16 +1857,22 @@
 acity) %7B
+%0A     
  this.st
@@ -1887,18 +1887,100 @@
 sh(val);
- %7D
+%0A      if (val %3E this.maxes%5Bthis.maxes.length - 1%5D) %7B this.maxes.push(val); %7D%0A    %7D%0A
 %0A    ret
@@ -2112,16 +2112,47 @@
 p method
+. Check if maximum for removal.
 %0A   *%0A  
@@ -2215,33 +2215,38 @@
 *%0A   * @return %7B
-*
+Number
 %7D - value remove
@@ -2293,24 +2293,179 @@
 /%0A  pop() %7B%0A
+    const popped = this.storage%5Bthis.storage.length - 1%5D;%0A    const max = this.maxes%5Bthis.maxes.length - 1%5D;%0A    if (popped === max) %7B this.maxes.pop(); %7D%0A
     return t

Implement getMax