public static int [] rowSums(int[][] arr2D){
    int[] rowSum = new int[arr2D.length];
    int i = 0;
    for(int[] arr:arr2D){
        rowSum[i] = arraySum(arr);
        i++;
    }
    return rowSum;
}
int [][] arrayThing = {
    {1,3,2,7,3},{10,10,4,6,2},{5,3,5,9,6},{7,6,4,2,1}
    };
System.out.println(Arrays.toString(rowSums(arrayThing)));
[16, 32, 28, 20]
public static boolean isDiverse(int[][] arr2D){
    int[] sumRows = rowSums(arrayThing);
    for(int i = 0; i < sumRows.length; i++){
        for(int j = i+1; j < sumRows.length; j++){
            if (sumRows[i] == sumRows[j]){
                return false;
            }
        }
    }
    return true;
}
System.out.println(isDiverse(arrayThing));
true
public class hiddenWord{
    String secretWord;
    public hiddenWord(String secretWord){
        this.secretWord = secretWord;
    }
    public String getHint(String guess){
        // test for uppercase only
        String secretWord = this.secretWord;
        int wordLength = secretWord.length();
        String hint = "";
        for(int i = 0; i < wordLength; i++){
            if(guess.charAt(i) == secretWord.charAt(i)){
                hint += secretWord.charAt(i);
            }
            else if(secretWord.indexOf(guess.charAt(i)) != -1){
                hint += '+';
            } else {
                hint += '*';
            }
        }
        return hint;
    }
    public static void main(String args[]){
        hiddenWord puzzle = new hiddenWord("HARPS");
        System.out.println(puzzle.getHint("AAAAA"));
        System.out.println(puzzle.getHint("HELLO"));
        System.out.println(puzzle.getHint("HEART"));
        System.out.println(puzzle.getHint("HARMS"));
        System.out.println(puzzle.getHint("HARPS"));
    }
}

hiddenWord.main(null);
+A+++
H****
H*++*
HAR*S
HARPS
// Creating Sparse Array
public class SparseArrayEntry{
    private int row;
    private int col;
    private int value; // value of entry in sparse array

    public SparseArrayEntry(int r, int c, int v){
        row = r;
        col = c;
        value = v;
    }

    public int getRow(){
        return row;
    }

    public int getCol(){
        return col;
    }

    public int getValue(){
        return value;
    }
}

// Representing Sparse Array
public class SparseArray{
    private int numRows;
    private int numCols;
    private List<SparseArrayEntry> entries;

    public SparseArray(){
        entries = new ArrayList<SparseArrayEntry>();
        SparseArrayEntry entry1 = new SparseArrayEntry(1,4,4);
        SparseArrayEntry entry2 = new SparseArrayEntry(2,0,1);
        SparseArrayEntry entry3 = new SparseArrayEntry(3,1,-9);
        SparseArrayEntry entry4 = new SparseArrayEntry(1,1,5);    
        entries.add(entry1);
        entries.add(entry2);
        entries.add(entry3);
        entries.add(entry4);

        for(SparseArrayEntry entry : entries){
            if(entry.getRow() > numRows){
                numRows = entry.getRow();
            }
            if(entry.getCol() > numCols){
                numCols = entry.getCol();
            }
        }
    }

    public int getNumRows(){
        return numRows;
    }

    public int getNumCols(){
        return numCols;
    }

    // PART A:
    public int getValueAt(int row, int col){
        for(SparseArrayEntry entry : entries){
            if(entry.getRow() == row && entry.getCol() == col){
                return entry.getValue();
            } 
        } 
        return 0;
    }

    // PART B:
    public void removeColumn(int col){
        System.out.println("\nBefore removal method:"); 
        System.out.println("-----------------------");
        for(SparseArrayEntry entry : entries){
            System.out.println(entry.getRow() + " " + entry.getCol() + " " + entry.getValue());
        }
        entries.removeIf(entry -> entry.getCol() == col); // attempted using entries.remove(), however it was not accurately removing the correct 
        int i = 0;
        for(SparseArrayEntry entry : entries){
            // if(entry.getCol() == col){
            //     entries.remove(i);
            // }
            if(entry.getCol() > i){
                SparseArrayEntry editedEntry = new SparseArrayEntry(entry.getRow(), entry.getCol() - 1, entry.getValue());
                entries.set(i, editedEntry);
            }
            i++;
        }
        this.numCols -= 1;
        System.out.println("\nAfter removal method:");
        System.out.println("-----------------------");
        for(SparseArrayEntry entry : entries){
            System.out.println(entry.getRow() + " " + entry.getCol() + " " + entry.getValue());
        }

        this.numCols = this.numCols;
    }

    public static void main(String[] args){
        SparseArray spArray = new SparseArray();

        System.out.println("Part A Testing (Retrieving data at a certain point):");
        System.out.println(spArray.getValueAt(1,4));

        System.out.println("\nPart B Testing (Removing data at a certain column):");
        spArray.removeColumn(1);
    }
}

SparseArray.main(null);
Part A Testing (Retrieving data at a certain point):
4

Part B Testing (Removing data at a certain column):

Before removal method:
-----------------------
1 4 4
2 0 1
3 1 -9
1 1 5

After removal method:
-----------------------
1 3 4
2 0 1
// PART A
public interface NumberGroup{
    boolean contains(int val);
}

// PART B
public class Range implements NumberGroup{
    public int min;
    public int max;

    public Range(int min, int max){
        this.min = min;
        this.max = max;
    }

    @Override 
    public boolean contains(int val){
        if(val <= this.max && val >= this.min){
            return true;
        }
        return false;
    }
}
public class bMain {
    public static void main(String[] args) {
        NumberGroup range = new Range(5, 10);

        System.out.println("\nPart B Testing");
        System.out.println("-----------------");
        System.out.println(range.contains(5));  // true
        System.out.println(range.contains(10)); // true
        System.out.println(range.contains(7));  // true
        System.out.println(range.contains(4));  // false
        System.out.println(range.contains(11)); // false
    }
}
bMain.main(null);


// PART C
public class multipleGroups{
    private List<NumberGroup> groupList;
    public multipleGroups(List<NumberGroup> groupList){
        this.groupList = groupList;
    }
    public boolean contains(int num){
        for(NumberGroup group : groupList){
            if(group.contains(num)){
                return true;
            }
        }
        return false;
    }
    public static void main(String[] args) {
        Range range1 = new Range(1, 5);
        Range range2 = new Range(10, 15);
        Range range3 = new Range(20, 25);
        
        System.out.println("\nPart C Testing");
        System.out.println("-----------------");
        System.out.println(range1.contains(3));  // true 
        System.out.println(range2.contains(10)); // true
        System.out.println(range3.contains(19)); // false
        System.out.println(range1.contains(18)); // false
        System.out.println(range2.contains(11)); // true
        System.out.println(range3.contains(1));  // false
    }
}

multipleGroups.main(null);
Part B Testing
-----------------
true
true


true
false
false

Part C Testing
-----------------
true
true
false
false
true
false