This file contains hidden or 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
#Function is called with a string | |
import collections | |
def isAnagramOfPalindrome(S): | |
# Check length if length even then all need to be two | |
# if not even there must be a -1 | |
dic = collections.defaultdict(int) | |
for c in S: | |
dic[c] += 1 |
This file contains hidden or 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
# Translated from the reference implementation at https://github.com/veorq/SipHash | |
import cython | |
from libc.stdint cimport uint8_t, uint32_t, uint64_t | |
DEF cROUNDS = 2 | |
DEF dROUNDS = 4 | |
cdef inline uint64_t _rotl(uint64_t x, uint64_t b) nogil: | |
return (x << b) | (x >> (64 - b)) |