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
class lettersInAlphabeticalOrder { | |
public static void main(String[] args) { | |
String[] array = new String[]{"billowy", "biopsy", "chinos", "defaced", "chintz", "sponged", "bijoux", "abhors", "fiddle", "begins", "chimps", "wronged"}; | |
for (int i = 0; i < array.length; i++) { | |
System.out.println(array[i] + " " + isAlphabetical(array[i])); | |
} | |
} | |
public static String isAlphabetical(String input) { | |
input = input.toLowerCase(); | |
boolean failed = false; |
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.awt.image.BufferedImage; | |
import javax.imageio.*; | |
import java.io.*; | |
import java.awt.Color; | |
import java.awt.Point; | |
import java.util.*; | |
class estimatingPiBonus { | |
public static void main(String[] args) { | |
Color black = new Color(0,0,0); | |
BufferedImage img = null; |
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.*; | |
class addingFractions { | |
public static void main(String[] args) { | |
File input = new File("challengeinput2.in"); | |
try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(input)))) { | |
int numberOfLines = Integer.parseInt(reader.readLine()); | |
int currentCase = 1; | |
//parse the inputs into arrays | |
long[] numeratorArray = new long[numberOfLines]; |
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.awt.image.BufferedImage; | |
import javax.imageio.*; | |
import java.io.*; | |
import java.awt.Color; | |
class estimatingPi { | |
public static void main(String[] args) { | |
BufferedImage img = null; | |
try { | |
img = ImageIO.read(new File("input2.png")); | |
double greatest = 0; |
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.*; | |
class decolumnizing { | |
public static void main(String[] args) { | |
File input = new File("input1.in"); | |
try { | |
System.setOut(new PrintStream(new FileOutputStream("systemout1.txt"))); | |
} catch (IOException ex) { | |
ex.printStackTrace(); | |
} |
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
class eelOfFortune { | |
public static void main(String[] args) { | |
System.out.println("synchronized -> " + problem("synchronized", "snond")); //true | |
System.out.println("misfunctioned -> " + problem("misfunctioned", "snond")); //true | |
System.out.println("mispronounced -> " + problem("mispronounced", "snond")); //false | |
System.out.println("shotgunned -> " + problem("shotgunned", "snond")); //false | |
System.out.println("snond -> " + problem("snond", "snond")); //true | |
} | |
public static boolean problem(String secretWord, String problemWord) { |
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
class garlandWords { | |
public static void main(String[] args) { | |
String example1 = "programmer"; | |
String example2 = "ceramic"; | |
String example3 = "onion"; | |
String example4 = "alfalfa"; | |
String testExample = "abcdeabcd"; | |
int answer; | |
answer = garland(example1); | |
answer = garland(example2); |
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
SHENANIGANS | |
A | |
L | |
T | |
YOUNGSTER | |
O | |
U | |
N | |
DOUBLET | |
E |
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
//Problem statement: https://www.reddit.com/r/dailyprogrammer/comments/3bzipa/20150703_challenge_221_hard_poetry_in_a_haystack/ | |
//English word list file: https://code.google.com/p/dotnetperls-controls/downloads/detail?name=enable1.txt | |
//text file in which to find the poetry: https://gist.githubusercontent.com/anonymous/c8fb349e9ae4fcb40cb5/raw/05a1ef03626057e1b57b5bbdddc4c2373ce4b465/challenge.txt | |
import java.io.*; | |
import java.util.*; | |
class poetryInAHaystack { | |
public static void main(String[] args) { | |
long startTime = System.currentTimeMillis(); | |
File wordList = new File("englishWordList.txt"); |
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
//https://www.reddit.com/r/dailyprogrammer/comments/3aqvjn/20150622_challenge_220_easy_mangling_sentences/ | |
class manglingSentences { | |
public static void main(String[] args) { | |
//proof of concept for word sorter - punctuation stays in place, letters are alphabetized, uppercase positions preserved | |
//System.out.println(wordSorter(stringToArray("Q^azC-;%bDEn"))); | |
String inputSentenceTest = "The quick brown fox jumps over the lazy dog."; | |
String inputSentence1 = "This challenge doesn't seem so hard."; | |
String inputSentence2 = "There are more things between heaven and earth, Horatio, than are dreamt of in your philosophy."; | |
String challengeInput1 = "Eye of Newt, and Toe of Frog, Wool of Bat, and Tongue of Dog."; | |
String challengeInput2 = "Adder's fork, and Blind-worm's sting, Lizard's leg, and Howlet's wing."; |
NewerOlder