let the len of first array be n
it run in O(n)
create 26 letter array cost is constant, count the occuance of each letter in array1 is O(n) check whether the element in array2 is indeed in array1 is O(n)
Totally O(n)
let the len of first array be n
it run in O(n)
create 26 letter array cost is constant, count the occuance of each letter in array1 is O(n) check whether the element in array2 is indeed in array1 is O(n)
Totally O(n)
from math import sqrt,log,ceil | |
def fibo(n): | |
return int((((1+sqrt(5))**n)-((1-sqrt(5))**n))/((2**n)*sqrt(5))) | |
def nearestFibo(array): | |
for k in array: | |
larger_Nearest_Fibo = ceil( (log(sqrt(5)*k)) /(log((1+sqrt(5))/2)) ) | |
print(fibo(larger_Nearest_Fibo)) |
the problem is that the variable i, within each of the inside anonymous functions, is bound to the same variable outside of the function.
we could just do this
function createfunc(k) { return function(i) { return i+k; }; }
function createArrayOfFunctions(y){
import string | |
def isSubset(arr1,arr2): | |
d = dict.fromkeys(string.ascii_lowercase, 0) | |
for i in arr1: | |
d[i]+=1 | |
for j in arr2: | |
if d[j] == 0: | |
return False |
Based on this dribbble shot: https://dribbble.com/shots/2432743-Clash-Cards-Preview
A Pen by Andre Madarang on CodePen.
QUERY=""" | |
query { | |
user(login:"AronWater") { | |
repositories(last:100) { ######### putting 100 here might generate timeout error | |
totalCount | |
totalDiskUsage | |
pageInfo { | |
endCursor | |
hasNextPage |
QUERY=""" | |
query { | |
user(login:"YOURUSERNAME_HERE") { | |
repositories(last:100) { ######### putting 100 here might generate timeout error | |
totalCount | |
totalDiskUsage | |
pageInfo { | |
endCursor | |
hasNextPage |
query { | |
user(login:"AronWater") { | |
repositories(first:1,after:null) | |
{ | |
totalCount | |
totalDiskUsage | |
pageInfo { | |
endCursor | |
hasNextPage | |
hasPreviousPage |