This file contains hidden or 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 searchAndDestroy { | |
public static void main(String[] args) throws IOException{ | |
Scanner input = new Scanner(System.in); | |
//Establish array length |
This file contains hidden or 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.Scanner; | |
public class rowscols { | |
public static void main (String [] args) { | |
Scanner input = new Scanner(System.in); | |
int para1 = input.nextInt(); | |
This file contains hidden or 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
//Convertanupper-caselettertoalowercaseletterandreturnthelower | |
//case letter. (Hint: Check first to be sure that it is not lower case already.) | |
import java.util.Scanner; | |
public class dacase { | |
public static void main(String[]args){ | |
Scanner input = new Scanner(System.in); | |
char a = input.nextln(); | |
char b = a.charAt(0); |
This file contains hidden or 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
/*Returntrueifthearraycontains,somewhere,threeincreasingadjacent numbers like 4, 5, 6 or 23, 24, 25. | |
tripleUp({1, 4, 5, 6, 2}) → true tripleUp({1, 2, 3}) → true tripleUp({1, 2, 4}) → false | |
public boolean tripleUp(int[] nums)*/ | |
import java.util.Scanner; | |
public class uniqueAdjacent { | |
public static void main(String[] args){ | |
Scanner input = new Scanner(System.in); | |
//Establish array length |
This file contains hidden or 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
/*Returntrueifthearraycontains,somewhere,threeincreasingadjacent numbers like 4, 5, 6 or 23, 24, 25. | |
tripleUp({1, 4, 5, 6, 2}) → true tripleUp({1, 2, 3}) → true tripleUp({1, 2, 4}) → false | |
public boolean tripleUp(int[] nums)*/ | |
import java.util.Scanner; | |
public class adjacent { | |
public static void main(String[] args){ | |
Scanner input = new Scanner(System.in); | |
//Establish array length |
This file contains hidden or 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
/* Returnthesumofthenumbersinthearray,returning0foranempty array. | |
Except the number 13 is very unlucky, so it does not count and numbers | |
that come immediately after a 13 also do not count. | |
sum13({1, 2, 2, 1}) → 6 | |
*/ | |
import java.util.Scanner; | |
public class internalsum{ | |
public static void main(String [] args) | |
{ |
This file contains hidden or 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
/*Write a method public static int max(int[][] a)that | |
returns the maximum value in the 2d parameter array a. | |
*/ | |
import java.util.Scanner; | |
public class maximumArray{ | |
public static int max(int[][] my2d) { | |
Scanner input = new Scanner(System.in); |
This file contains hidden or 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
/*Returnanarraythatis"leftshifted"byone--so{6,2,5,3}returns{2,5,3, 6}. You may modify and return the given array, or return a new array. | |
shiftLeft({6, 2, 5, 3}) → {2, 5, 3, 6} shiftLeft({1, 2}) → {2, 1} shiftLeft({1}) → {1} | |
public int[] shiftLeft(int[] nums) | |
*/ | |
import java.util.Scanner; | |
public class holyshift { | |
public static void main(String [] args) { | |
This file contains hidden or 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
//Foranygiven(small)number,printasquareofasteriskswiththelengthof each side equal to the given number. | |
import java.util.Scanner; | |
public class asteriskz{ | |
public static void main(String[] args){ | |
Scanner input = new Scanner(System.in); | |
int asteriskNumber = input.nextInt(); |
This file contains hidden or 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
// Calculate and return the area of a circle, given the radius. | |
import java.util.Scanner; | |
public class circleArea { | |
public static void main (String[] args){ | |
Scanner input = new Scanner(System.in); | |
double radius = input.nextDouble(); | |
radius = calculateArea(radius); |