Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def search(nums, target) -> int: | |
high = len(nums) - 1 | |
low, mid = 0, 0 | |
while low <= high: | |
mid = (high + low)// 2 | |
if nums[mid] < target: | |
low = mid + 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
class Solution: | |
def reverse(self, x: int) -> int: | |
ex = str(x) | |
if ex[0] == "-": | |
ex2 = ex[1:] | |
print(ex2[::-1]) | |
if not((-2)**31 < int(ex2[::-1]) < 2**31 - 1): | |
return 0 | |
return ex[0] + str(int(ex2[::-1])) | |
else: |
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
import numpy as np | |
class Solution: | |
def areaEdge(self, h_w: int, Cuts: List[int]) -> int: | |
Cuts.insert(len(Cuts), h_w) | |
temp_list = Cuts[:-1] | |
temp_list.insert(0,0) | |
Cuts.sort() | |
temp_list.sort() |
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
def CodelandUsernameValidation(strParam): | |
if (4<len(strParam)<25) or (strParam[0] != str) or strParam[-1] == "_": | |
return False | |
return True | |
# keep this function call here | |
print(CodelandUsernameValidation(input())) | |
""" |
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 that runs the requested algorithm and returns the accuracy metrics | |
def fit_ml_algo(algo, X_train, y_train, cv): | |
# One Pass | |
model = algo.fit(X_train, y_train) | |
acc = round(model.score(X_train, y_train) * 100, 2) | |
# Cross Validation | |
train_pred = model_selection.cross_val_predict(algo, | |
X_train, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder