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 A: | |
def __del__(self): | |
print('Deleting') | |
def foo(): | |
while True: | |
print 'Making' | |
a = A() |
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 Primes { | |
public static void main(String[] args) { | |
int n = 34; | |
int count = 0; | |
// for (int k=2; ; k++) { | |
int k = 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 Sevens { | |
public static void main(String[] args) { | |
int min = 1; | |
int max = 100; | |
int seven = 0; | |
for (int k=min; k<=max; k++) { | |
if ((k / 1) % 10 == 7) { | |
seven++; |
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 SmLr { | |
public static void main(String[] args) { | |
int stop = IO.readInt(); | |
int input = IO.readInt(); | |
int highest = input; | |
int lowest = input; | |
while (input != stop) { |
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 Time { | |
public static void main(String[] args) { | |
long now = System.currentTimeMillis(); | |
int count = 0; | |
while (System.currentTimeMillis() - now <= 100) { | |
Math.sin(2); | |
count++; |
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 Collatz { | |
public static void main(String[] args) { | |
int n; | |
int count = 0; | |
int highest = 0; | |
int k = 1; | |
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 Anagram { | |
public static void main(String[] args) { | |
String a = IO.readString(); | |
String b = IO.readString(); | |
boolean anagram = true; | |
int count = 0; | |
if (a.length()==b.length()) { | |
for ( int i = 0 ; i < a.length() ; i++) { |
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 Pal { | |
public static void main(String[] args) { | |
String word = "Racecar"; | |
word = word.toLowerCase(); | |
boolean ok = true; | |
for (int n=0; n<=word.length()-1; n++) { | |
if (word.charAt(n) == word.charAt(word.length() - n - 1)) { | |
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 Pairs { | |
public static void main(String[] args) { | |
int[] cards = { 1, 2, 4, 1, 7 }; | |
boolean pair = false; | |
for (int i=0; i<cards.length; i++) { | |
for (int j=i+1; j<cards.length; j++) { | |
if (cards[i] == cards[j]) { |
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 reversereverse { | |
public static void main(String[] args){ | |
int[] data = {1, 2, 3, 4, 5, 6, 7, 8, 9}; | |
for (int i = 0; i<data.length/2; i++){ | |
int a = data[i]; | |
data[i] = data[data.length - i - 1]; | |
data[data.length - i - 1] = a; | |
} | |
System.out.println(java.util.Arrays.toString(data)); |
OlderNewer