Skip to content

Instantly share code, notes, and snippets.

View kopatsy's full-sized avatar

Arthur Kopatsy kopatsy

View GitHub Profile
from itertools import permutations
class Solution:
def minStickers(self, stickers: List[str], target: str) -> int:
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47] # 15
letters = {}
for t in target:
if t not in letters:
letters[t] = primes.pop(0)
def getNewEPrice(up, customVar=None):
margin_percent = .24
margin_fixed = 0
min_margin = 4
ao_fee = 1
x = (up + max((up * margin_percent + margin_fixed),min_margin) + ao_fee + 0.3) / (0.871)
return int(x) + 0.99
print "%.5f" % getNewEPrice(10)
@kopatsy
kopatsy / gist:a9083762cc8cf479b2d6
Last active August 29, 2015 14:12
Repro Unit test for issue 10612
it('should play nice with repeater when replacing with templateUrl', function() {
module(function() {
directive('repeatedTemplate', valueFn({
replace: true,
templateUrl: 'template.html',
}));
});
inject(function($compile, $httpBackend, $rootScope) {
$httpBackend.expect('GET', 'template.html').
from collections import defaultdict
def solve(words):
letters = set()
for word in words:
letters.update(word)
dependencies = get_dependencies(words)
roots = build_roots(letters, dependencies)
Operating system: Linux
0.0.0 Linux 2.6.32-351-ec2 #62-Ubuntu SMP Mon Mar 4 09:24:50 UTC 2013 x86_64
CPU: amd64
family 6 model 44 stepping 2
4 CPUs
Crash reason: SIGSEGV
Crash address: 0x3
Thread 0 (crashed)
Operating system: Linux
0.0.0 Linux 2.6.32-351-ec2 #62-Ubuntu SMP Mon Mar 4 09:24:50 UTC 2013 x86_64
CPU: amd64
family 6 model 44 stepping 2
4 CPUs
Crash reason: SIGSEGV
Crash address: 0x18
Thread 0 (crashed)
Operating system: Linux
0.0.0 Linux 2.6.32-351-ec2 #62-Ubuntu SMP Mon Mar 4 09:24:50 UTC 2013 x86_64
CPU: amd64
family 6 model 44 stepping 2
4 CPUs
Crash reason: SIGSEGV
Crash address: 0x3
Thread 0 (crashed)
Operating system: Linux
0.0.0 Linux 2.6.32-351-ec2 #62-Ubuntu SMP Mon Mar 4 09:24:50 UTC 2013 x86_64
CPU: amd64
family 6 model 44 stepping 2
4 CPUs
Crash reason: SIGSEGV
Crash address: 0x3
Thread 0 (crashed)
Operating system: Linux
0.0.0 Linux 2.6.32-351-ec2 #62-Ubuntu SMP Mon Mar 4 09:24:50 UTC 2013 x86_64
CPU: amd64
family 6 model 44 stepping 2
4 CPUs
Crash reason: SIGSEGV
Crash address: 0x3
Thread 0 (crashed)
Operating system: Linux
0.0.0 Linux 2.6.32-351-ec2 #62-Ubuntu SMP Mon Mar 4 09:24:50 UTC 2013 x86_64
CPU: amd64
family 6 model 44 stepping 2
4 CPUs
Crash reason: SIGSEGV
Crash address: 0x3
Thread 0 (crashed)