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.util.*; | |
class Lifeguard implements Comparable<Lifeguard>{ | |
int start, stop; | |
public int compareTo(Lifeguard o) { | |
return (start - o.start); | |
} | |
} |
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
public class Challenge { | |
public static boolean isMagicSquare(int[][] square) { | |
int n = square.length; | |
int a[][] = square; | |
int diag1 = 0; | |
int diag2 = 0; | |
for(int k = 0; k < n; k+=1) { | |
diag1 += a[k][k]; |
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
from random import * | |
positions = sample([1,2,3,4,5,6,7,8,9,10], 3) | |
positions.sort() | |
print(positions) | |
if positions[2] - positions[1] == 1 and positions[1] - positions[0] == 1: | |
print(0) | |
elif positions[2] - positions[1] == 2 or positions[1] - positions[0] == 2: | |
print(1) | |
else: | |
print(2) |
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
public class J4U_Example_5_26_2020 { | |
public static void main(String args[]) { | |
char c1 = 'A'; | |
char c2 = 'B'; | |
char c3 = 'C'; | |
System.out.println(c1+c2+c3); | |
// System.out.print(c1); | |
// System.out.print(c2); | |
// System.out.println(c3); |
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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class BallController : MonoBehaviour | |
{ | |
public float acceleration; | |
public CameraController2 camera; | |
private Rigidbody rigidBody; |
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.util.*; | |
public class MyClass { | |
public static void main(String args[]) { | |
System.out.println("ARRAYLIST EXAMPLE"); | |
ArrayList<Integer> ints = new ArrayList<Integer>(); | |
int[] arr = new int[10]; | |
//arr[0] = 5; |
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
data = open("family.in", "r").readlines() | |
# Step 1 - Read Data | |
l0 = data[0].split(); | |
N = int(l0[0]) | |
bessie = l0[1]; | |
elsie = l0[2]; | |
#print(N, bessie, elsie) | |
# Step 2 - Family Tree as Dict |
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
// File 1 | |
public class graycoding { | |
public static void main(String args[]) { | |
int twenty[] = new int[]{10, 0, 1, 11, 12, 2, 3, 13, 14, 4, 5, 15, 16, 6, 7, 17, 18, 8, 9, 19}; | |
boolean odd = false; | |
for(int i = 0; i < 5; i+=1) { | |
for (int j = 0; j < 20; j+=1) { | |
System.out.println(i*20 + twenty[ odd ? 19-j : j]); | |
} | |
odd = !odd; |
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 Point2D { | |
int x, y; | |
public boolean equals(Object o) { | |
Point2D other = (Point2D)o; | |
return x == other.x && y == other.y; | |
} | |
} | |
public class MyClass { |
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.util.Scanner; | |
public class TicTacTocAlaAiden { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
String a=" "; | |
String b=" "; | |
String c=" "; | |
String d=" "; | |
String e=" "; | |
String f=" "; |
NewerOlder