For those who just want to look at code to get started.
More info at:
Swift version is here.
.frbanner { | |
display: none; | |
} | |
#mw-page-base { | |
margin-top: 0; | |
} |
For those who just want to look at code to get started.
More info at:
Swift version is here.
// jQuery.fn.wait | |
// Copyright 2015 pengxwang.com | |
// Released under the MIT license | |
/* | |
$.fn.wait = (args...) -> | |
d = $.Deferred() | |
k = "wait-#{id}-promise" | |
p = d.promise() | |
if args.length is 1 |
#constructor
initialState
#switchState
#onEnter
on new statefrom math import sqrt | |
def is_prime(n): | |
print 'Checking {}'.format(n) | |
if n == 1: return True | |
root = sqrt(n) | |
if root % 1 == 0: | |
print "{} isn't prime, with square root of {}".format(n, root) | |
return False | |
try_factor = 2 |
allSquaredPairs = (num) -> | |
isInt = (num) -> num % 1 is 0 | |
pairs = [] | |
floor = 0 | |
ceiling = Math.ceil Math.sqrt(num) | |
for x in [floor...ceiling] | |
numX = Math.pow x, 2 | |
numY = num - numX | |
y = Math.sqrt numY | |
if y >= x and isInt(y) |
from math import floor | |
from sys import setrecursionlimit | |
setrecursionlimit(1000000) | |
""" | |
Use quick sort to explore pivoting rules. | |
TODO: Not working. | |
""" |
""" | |
Use merge sort to count inversions. | |
""" | |
with open('IntegerArray.txt') as f: | |
ints = [int(line) for line in f.readlines()] | |
#print 'First 5 ints:{}'.format(ints[:5:]) | |
inversions = 0 |