Skip to content

Instantly share code, notes, and snippets.

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
import java.util.Scanner;
public class rowscols {
public static void main (String [] args) {
Scanner input = new Scanner(System.in);
int para1 = input.nextInt();
//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);
/*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
/*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
/* 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)
{
/*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);
/*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) {
@JorgeOlvera
JorgeOlvera / asteriskz
Created February 13, 2014 04:19
Asterisks
//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();
// 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);