week 2 challenge

This commit is contained in:
Joshua Ashton
2024-02-04 15:54:05 -07:00
parent f0a34db016
commit 7876f90b48
30 changed files with 101 additions and 3 deletions
+5 -1
View File
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=""/> <classpathentry kind="src" path=""/>
<classpathentry kind="output" path=""/> <classpathentry kind="output" path=""/>
</classpath> </classpath>
+1
View File
@@ -0,0 +1 @@
/App.class
@@ -1,3 +1,5 @@
package fall23.Week11;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Scanner; import java.util.Scanner;
+4
View File
@@ -0,0 +1,4 @@
/SNAFU$Input$SNAFUIterator.class
/SNAFU$Input.class
/SNAFU.class
/SNAFUChallenge.class
@@ -1,3 +1,5 @@
package fall23.Week13;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileReader; import java.io.FileReader;
@@ -1,3 +1,5 @@
package fall23.Week13;
/** /**
* Full Instructions and Explanation: https://adventofcode.com/2022/day/25 * Full Instructions and Explanation: https://adventofcode.com/2022/day/25
* *
+1
View File
@@ -0,0 +1 @@
/Week2.class
@@ -1,3 +1,5 @@
package fall23.Week2;
/** /**
* Sum of Multiples of 3 or 5. * Sum of Multiples of 3 or 5.
* *
+2
View File
@@ -0,0 +1,2 @@
/Week4.class
/Week4Bonus.class
@@ -1,3 +1,5 @@
package fall23.Week4;
/** /**
* In this week's club bonus challenges, you will be tasked with solving problems relating to the Fibonacci Sequence. * In this week's club bonus challenges, you will be tasked with solving problems relating to the Fibonacci Sequence.
* *
@@ -1,7 +1,9 @@
package fall23.Week4;
/** /**
* In this week's club bonus challenge, you will be tasked with solving grid traversal problem. * In this week's club bonus challenge, you will be tasked with solving grid traversal problem.
*/ */
public class Week4 { public class Week4Bonus {
/** /**
* In a 2x2 grid, there are exactly 6 routes from the top-left corner to the bottom-right corner. * In a 2x2 grid, there are exactly 6 routes from the top-left corner to the bottom-right corner.
@@ -21,6 +23,6 @@ public class Week4 {
public static void main(String[] args) { public static void main(String[] args) {
long ans1 = problem1(); long ans1 = problem1();
System.out.println(ans1 == 137846528820 ? "Problem 1 is correct!" : "Problem 1 (" + ans1 + ") is not correct..."); System.out.println(ans1 == 137846528820L ? "Problem 1 is correct!" : "Problem 1 (" + ans1 + ") is not correct...");
} }
} }
+8
View File
@@ -0,0 +1,8 @@
/Task$SortByTitleComparator.class
/Task.class
/Week9.class
/Week9Gui.class
/Week9$1.class
/Week9$2.class
/Week9$3.class
/Week9$4.class
@@ -1,3 +1,4 @@
package fall23.Week9;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
@@ -1,3 +1,5 @@
package fall23.Week9;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.BufferedReader; import java.io.BufferedReader;
@@ -1,3 +1,5 @@
package fall23.Week9;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.JFrame; import javax.swing.JFrame;
+2
View File
@@ -0,0 +1,2 @@
/Challenge.class
/BonusChallenge.class
+59
View File
@@ -0,0 +1,59 @@
package spring24.week2;
/**
*
* This weeks Coding Challenge is inspired by Leetcode problem 9.
*
* A palindrome is defined as a String of characters which are the same forwards and backwards.
* eg. 123321
* asdfdsa
* kayak
*
* BONUS CHALLENGE:
*
* Allow for two modes, a "palindrome generator" and a "palindrome checker". The generator prompts the user to enter in any sequence of characters, and converts it into a palindrome.
* The checker prompts the user to enter in any sequence of characters and then checks if it is a palindrome.
*
*/
public class Challenge {
/**
* Determines if an input string is a palindrome.
*
* @param input
* @return
*/
public boolean isPalindrome(String input) {
return false; // TODO
}
/**
* Tests for isPalindrome method.
*
* @param args
*/
public static void main(String[] args) {
Challenge c = new Challenge();
// Test 123321
System.out.print("Palindrome 123321 answer is: ");
System.out.println(c.isPalindrome("123321") ? "correct!" : "incorrect!");
// Test asdfdsa
System.out.print("Palindrome asdfdsa answer is: ");
System.out.println(c.isPalindrome("asdfdsa") ? "correct!" : "incorrect!");
// Test kayak
System.out.print("Palindrome kayak answer is: ");
System.out.println(c.isPalindrome("kayak") ? "correct!" : "incorrect!");
// Test java
System.out.print("Palindrome java answer is: ");
System.out.println(c.isPalindrome("java") ? "incorrect!" : "correct!");
// Test 1969
System.out.print("Palindrome 1969 answer is: ");
System.out.println(c.isPalindrome("1969") ? "incorrect!" : "correct!");
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.