This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CodeWordChecker implements StringChecker { | |
private int min; | |
private int max; | |
private String no; | |
public CodeWordChecker(int mi, int ma, String n) { | |
min = mi; | |
max = ma; | |
no = n; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public WordPairList(String[] words) { | |
allPairs = new ArrayList<>(); | |
for (int i=0; i<words.length; i++) | |
for (x=i+1; x<words.length; x++) | |
allPairs.add(new WordPair(words[i], words[x]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean simulate() { | |
int hops = 0; | |
int cntPos = 0; | |
while (hops < maxHops && cntPos >= 0 && cntPos < goalDistance) { | |
cntPos += hopDistance(); | |
hops++; | |
} | |
return cntPos >= goalDistance; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int[] getColumn(int[][] arr2D, int c) { | |
int[] out = new int[arr2D.length]; | |
for (int r=0; r<arr2D.length; r++) | |
out[r] = arr2D[r][c]; | |
return out; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var edit = ace.edit('editor'); | |
edit.commands.addCommand({ | |
name: "blockCtrlR", | |
exec: function () { | |
editor.promptRefresh(false); | |
}, | |
bindKey: {mac: "cmd-r", win: "ctrl-r"} | |
}); | |
edit.commands.addCommand({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Field; | |
import java.util.Arrays; | |
import org.junit.Test; | |
import static org.junit.Assert.*; | |
import org.junit.Before; | |
public class ImageGridTest { | |
private int rows; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
public class VowelCounter { | |
public static void main( String[] args ) { | |
// Your code goes here... | |
int cnt = 0; | |
try { | |
Scanner f = new Scanner(new File("words.dat")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
public class Demo { | |
private ArrayList<String> words; | |
public Demo( String[] theWords ) { | |
for (String s: theWords) { | |
words.add(s); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PrintSquare { | |
public void printSquare() { | |
// Your code goes here... | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
import static org.junit.Assert.*; | |
import org.junit.Test; | |
@SuppressWarnings( "unchecked" ) | |
public class OutputCaptureTest { | |
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream(); | |
private final ByteArrayOutputStream errContent = new ByteArrayOutputStream(); |