This file contains 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
library(caret) | |
library(HDtweedie) | |
elasticTweedie = list(library="HDtweedie", type="Regression") | |
prm = data.frame(parameter=c("alpha", "lambda"), | |
class=rep("numeric", 2), | |
label=c("alpha", "lambda_vec")) | |
elasticTweedieGrid = function(x, y, len=NULL, search="grid") { |
This file contains 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
class Solution: | |
def findRepeatedDnaSequences(self, s): | |
""" | |
:type s: str | |
:rtype: List[str] | |
""" | |
Map = dict() | |
for i in range(len(s)-9): | |
if s[i:i+10] not in Map.keys(): | |
Map[s[i:i+10]] = 1 |
This file contains 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
# Definition for a binary tree node. | |
# class TreeNode: | |
# def __init__(self, x): | |
# self.val = x | |
# self.left = None | |
# self.right = None | |
class Solution: | |
def isSymmetric(self, root): | |
""" |
This file contains 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
def merge(left_array,right_array): | |
''' | |
will be used in merge sort | |
assuming len(left_array) = len(right_array) | |
''' | |
result_array = [0]*len(left_array)*2 | |
left_index, right_index = 0, 0 | |
for result_index in range(0,len(result_array)): | |
if (left_index < len(left_array)-1) and (right_index < len(right_array)-1): |