Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .github/.keep
Empty file.
10 changes: 10 additions & 0 deletions src/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@ public class Problem {

public static Boolean avengersAssemble(boolean dcHero, boolean avengerHero) {

return null;
if (dcHero == false && avengerHero == false){
return true;
}

else if(dcHero == false && avengerHero){
return true;
}

else if (dcHero && avengerHero == false){
return false;
}
else {
return true;
}

}

Expand All @@ -32,8 +45,13 @@ public static Boolean avengersAssemble(boolean dcHero, boolean avengerHero) {
*/

public static Boolean nearValue(int n) {
if(( Math.abs(n) >=90 && Math.abs(n)<=100) || (Math.abs(n) >= 190 && Math.abs(n)<=200)){
return true;
}


return false;

return null;
}

/* Problem 4
Expand All @@ -47,8 +65,9 @@ public static Boolean nearValue(int n) {
*/

public static String missingLetter(String letter, int n) {

return null;
String firstHalf = letter.substring(0,n);
String secondHalf = letter.substring(n+1, letter.length());
return firstHalf+secondHalf;
}

/* Problem 5
Expand All @@ -62,8 +81,8 @@ public static String missingLetter(String letter, int n) {
*/

public static String wordOfDay(String word) {

return null;
char lastLetter = word.charAt(word.length()-1);
return lastLetter + word + lastLetter;
}

/* Problem 6
Expand All @@ -75,8 +94,10 @@ public static String wordOfDay(String word) {
*/

public static Boolean beginWithHi(String phrase) {

return null;
if (phrase.substring(0,2).equals("hi")){
return true;
}
return false;
}

/* Problem 7
Expand All @@ -89,8 +110,7 @@ public static Boolean beginWithHi(String phrase) {
*/

public static Boolean containTeen(int one, int two, int three){

return null;
return(!(one >= -12 && one <=12) || !(two >= -12 && two <=12) || !(three >= -12 && three <=12));
}

/* Problem 8
Expand All @@ -104,12 +124,11 @@ public static Boolean containTeen(int one, int two, int three){
*/

public static Boolean startWithIx(String phrase) {

return null;
return (phrase.substring(0,3) .equals("mix") || phrase.substring(1,3).equals("ix"));
}

/* Problem 9
Provide two numbers, evalute both numbers to see which one is nearest to the value 10.
Provide two numbers, evaluate both numbers to see which one is nearest to the value 10.
Some numbers may have the same range in how near they are to 10; such as 13 and 7 both are 3 from 10;
In that case, we would consider that event a tie.
Tip: Math.abs(n) returns the absolute value of a number
Expand All @@ -119,9 +138,18 @@ public static Boolean startWithIx(String phrase) {
near10(13, 7) --> 0
*/

public static Integer near10(int one, int two){
public static Integer near10(int one, int two) {
if (Math.abs(10-one) < Math.abs(10 - two)) {
return one;
}

return null;
else if (Math.abs(10-one) > Math.abs(10-two)) {
return two;
}

else {
return 0;
}
}

/* Problem 10
Expand All @@ -133,7 +161,17 @@ public static Integer near10(int one, int two){
*/

public static Boolean containE(String str) {

return null;
int eCounter = 0;
for (int i=0; i<str.length(); i++) {
if (str.charAt(i) == 'e') {
eCounter++;
}
}

if(1 <= eCounter && eCounter <= 3){
return true;
}

return false;
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Problem Set

You will be solving the given problems below.

### Problem 01
The parameter dcHero is true if it is an DC Hero,
and the parameter avengerHero is true if the hero is an Avenger.
Avengers will assemble if it is not a DC Hero, or they're an Avenger, or there is at least an Avenger on the team.

Return true if the avengers are ready to assemble.

Example:
```java
avengersAssemble(false, false) --> true
avengersAssemble(false, true) --> true
avengersAssemble(true, false) --> false
avengersAssemble(true, true) --> true
```

### Problem 03
You and your friends are out walking on the boardwalk at Atlantic City
and decided to go to Casino for the fun of it. One person won
___ amount of money. You're trying to find out if the amount was between 90-100 or 190-200.

Return true if the amount of money is within 10 of 100 or 200.

Tip: Math.abs(num) computes the absolute value of a number.

Example:
```java
nearValue(93) --> true
nearValue(90) --> true
nearValue(89) --> false
```
### Problem 04
The instructor provided you with a non-empty string and a number n.
The instructor wants you to remove the letter at index n and provide a new string.

Tip: Value of n should be a valid index of a given letter in the original string,
such as 0 or str.length()-1 inclusive

Example:
```java
missingLetter("kitten", 1) --> "ktten"
missingLetter("kitten", 0) --> "itten"
missingLetter("kitten", 4) --> "kittn"
```

### Problem 05
Given the word of the day, take the last letter and
return a new word of the day when you add the last letter to the front and back of the word.
For example, "founder" yields "rfounderr".

Tip: The word of the day will be a length 1 or more

Example:
```java
wordOfDay("cat") --> "tcatt"
wordOfDay("Hello" --> "oHelloo"
wordOfDay("a") --> "aaa"
```

### Problem 06
Johnnys favorite pharse to say is hi, he wants to know if the pharses given start with "hi".
Provide Johnny with a string, and return true if the string starts with "hi" and false otherwise.

Example:
```java
beginWithHi("hi there") --> true
beginWithHi("hi") --> true
beginWithHi("hello hi") --> false
```

### Problem 07
If you think of the basic numbers 0-20, you will notice that 13-19 contain the word "teen" in them.
The math instructor provides you with 3 numbers, you need to decided if 1 or more of them contain teen.

Return true if 1 or more of them contain teen.

Example:
```java
containTeen(13, 20, 10) --> true
containTeen(20, 19, 10) --> true
containTeen(20, 10, 13) --> true
```

### Problem 08
Your local rapper is looking to create his next hook for his next track. He wants to add phrases that begin with "mix".
But he decides he wants to take it a step further and accept any phrase except the "m" can be any letter or number.
He needs your help to make sure the list of given phrases begin with what was asked.

Return true if the given phrase begins with "mix", or any beginning letter or number following "ix"

Example:
```java
startWithIx("mix snacks") --> true
startWithIx("pix snacks") --> true
startWithIx("piz snacks") --> false
```

### Problem 09
Provide two numbers, evalute both numbers to see which one is nearest to the value 10.
Some numbers may have the same range in how near they are to 10; such as 13 and 7 both are 3 from 10;
In that case, we would consider that event a tie.

Tip: Math.abs(n) returns the absolute value of a number

Return whichever number is nearest to 10, or return 0 for the event of a tie.

Example:
```java
near10(8, 13) --> 8
near10(13, 8) --> 8
near10(13, 7) --> 0
```

### Problem 10
Determine if the given string contains between 1 and 3 'e' characters.
Only if the string contains between 1 and 3 'e' characters; return true.

Example:
```java
containE("Hello") --> true
containE("Heelle") --> true
containE("Heelele") --> false
```


## Submission

Commit and push your solution to GitHub
Binary file not shown.
Loading