weijiang2009
BAN USERint i = Int32.Parse(hex, NumberStyles.HexNumber);
}
NA
- weijiang2009 February 06, 2011def fun(n,memoryDict={}):
if n == 1:
return 1
if n == 2:
return 1
if n-1 not in memoryDict and n-2 not in memoryDict:
return fun(n-1,memoryDict) + fun(n-2,memoryDict)
elif n-1 in memoryDict and n-2 not in memoryDict:
return memoryDict[n-1] + fun(n-2,memoryDict)
elif n-1 not in memoryDict and n-2 in memoryDict:
return fun(n-1,memoryDict) + memoryDict[n-1]
else:
return memoryDict[n-1] + memoryDict[n-2]
#done
NA
- weijiang2009 February 06, 2011def method(String inputString):
order = "none"
inputStringList = list(inputString)
if int( inputStringList[0] ) <= int( inputStringList[1] ):
order = "increasing"
elif:
order = decreasing
for preIndex,pre in enumerate( inputStringList[:len(inputStringList)-1] ):
nextIndex = preIndex + 1
if order =="increasing":
if inputStringList[preIndex] > inputStringList[nextIndex]:
flag = false
elif order == "decreasing":
if inputStringList[preIndex] <= inputStringList[nextIndex]:
flag = false
if flag = False:
return False
elif:
return True
YES, indeed. Remove every kth node in a list, and then order the list again. Read the value from the next node and use the alg again. End when reach the range the program input give.
- weijiang2009 February 06, 2011parser generator like Lex Yacc or javacc will do.(for any given grammar.)
- weijiang2009 February 06, 2011for nlog(n): first sort list with merge sort in nlogn, then go over the list. For each item a, subtract a from I = b, and then search the b in the rest of the item in log(n). Since list is sorted, the list can be search in binary search with the time complexity of log(n)
- weijiang2009 February 06, 2011print "hello world" in python
- weijiang2009 February 06, 2011NA
- weijiang2009 February 06, 2011
Repemilinarula, Dev Lead at ABC TECH SUPPORT
Hi, i've been spotting for about 4 years.Teamwork: works well as a member of a team, pitches in ...
Linked List. NA
- weijiang2009 February 06, 2011