content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def solution(x, y): x = int(x) y = int(y) numCycles = 0 while (x > 1 or y > 1): if (x == y or x < 1 or y < 1): return "impossible" elif (x > y): factor = int(x/y) numCycles+=factor if (y == 1): numCycles-=1 ...
def solution(x, y): x = int(x) y = int(y) num_cycles = 0 while x > 1 or y > 1: if x == y or x < 1 or y < 1: return 'impossible' elif x > y: factor = int(x / y) num_cycles += factor if y == 1: num_cycles -= 1 ...
valores = [1, 2, 3, 4, 5, 6, 7, 8, 9] pares = list(filter(lambda x : x % 2 == 0, valores)) impares = list(filter(lambda x : x % 2 != 0, valores)) print(pares) print(impares)
valores = [1, 2, 3, 4, 5, 6, 7, 8, 9] pares = list(filter(lambda x: x % 2 == 0, valores)) impares = list(filter(lambda x: x % 2 != 0, valores)) print(pares) print(impares)
cpf = '04045683941' novo_cpf = cpf[:-2]#selecionando os 9 primeiros e deixando os dois ultimos #040456839 reverso = 10 total = 0 for index in range(19): if index > 8: index -= 9 total += int(novo_cpf[index]) * reverso print(cpf [index], index), reverso reverso -= 1 if reverso < 2: ...
cpf = '04045683941' novo_cpf = cpf[:-2] reverso = 10 total = 0 for index in range(19): if index > 8: index -= 9 total += int(novo_cpf[index]) * reverso (print(cpf[index], index), reverso) reverso -= 1 if reverso < 2: reverso = 11
class StubSoundPlayer: def __init__(self): pass def play_once(self, filename): pass def set_music_volume(self, new_volume): pass def change_music(self): pass def play_sound_event(self, sound_event): pass def process_events(self, sound_event_list):...
class Stubsoundplayer: def __init__(self): pass def play_once(self, filename): pass def set_music_volume(self, new_volume): pass def change_music(self): pass def play_sound_event(self, sound_event): pass def process_events(self, sound_event_list): ...
t = int(input()) for i in range(t): n, m = input().split() n = int(n) m = int(m) print((n-1)*(m-1))
t = int(input()) for i in range(t): (n, m) = input().split() n = int(n) m = int(m) print((n - 1) * (m - 1))
class Solution: def maximalSquare(self, matrix: List[List[str]]) -> int: if len(matrix)<1: return 0 dp=[[0 for i in range(len(matrix[0])+1)] for j in range(len(matrix)+1)] max1=0 for i in range(len(matrix)): for j in range(len(matrix[0])): if m...
class Solution: def maximal_square(self, matrix: List[List[str]]) -> int: if len(matrix) < 1: return 0 dp = [[0 for i in range(len(matrix[0]) + 1)] for j in range(len(matrix) + 1)] max1 = 0 for i in range(len(matrix)): for j in range(len(matrix[0])): ...
# # Common constants # APP_NAME = 'autonom' DEFAULT_CONFIG_FILE = 'autonom.ini' DEFAULT_SESSMGR = 'ticket' # We do this to convert run-time errors into compile time errors CF_DEFAULT = 'DEFAULT' CF_LISTEN = 'listen' CF_PORT = 'port' CF_PROVIDERS = 'providers' CF_FIXED_IP_LIST = 'fixed_ip_list' CF_LOG = 'log' CF_LOG_...
app_name = 'autonom' default_config_file = 'autonom.ini' default_sessmgr = 'ticket' cf_default = 'DEFAULT' cf_listen = 'listen' cf_port = 'port' cf_providers = 'providers' cf_fixed_ip_list = 'fixed_ip_list' cf_log = 'log' cf_log_ex = 'log_data' cf_provider = 'provider' cf_id = 'id' cf_href = 'href' cf_desc = 'desc' cf_...
class BudgetNotFound(Exception): pass class WrongPushException(Exception): def __init__(self, expected_delta, delta): self.expected_delta = expected_delta self.delta = delta string = 'tried to push a changed_entities with %d entities while we expected %d entities' @property def m...
class Budgetnotfound(Exception): pass class Wrongpushexception(Exception): def __init__(self, expected_delta, delta): self.expected_delta = expected_delta self.delta = delta string = 'tried to push a changed_entities with %d entities while we expected %d entities' @property def ms...
#Source : https://leetcode.com/problems/insertion-sort-list/ #Author : Yuan Wang #Date : 2021-02-01 ''' ********************************************************************************** *Sort a linked list using insertion sort. * *Example1 : *Input: 4->2->1->3 *Output: 1->2->3->4 ***********************************...
""" ********************************************************************************** *Sort a linked list using insertion sort. * *Example1 : *Input: 4->2->1->3 *Output: 1->2->3->4 **********************************************************************************/ """ def insertion_sort_list(self, head: ListNode) ->...
class ScoreCache: def __init__(self): self.parent_cache = dict() self.child_cache = dict() self.joint_cache = dict() def print(self): print("____CACHE_____") print("parents->(parent_states,parent_states_counts)") print(self.parent_cache) print("child->child_states_counts") print(self.child...
class Scorecache: def __init__(self): self.parent_cache = dict() self.child_cache = dict() self.joint_cache = dict() def print(self): print('____CACHE_____') print('parents->(parent_states,parent_states_counts)') print(self.parent_cache) print('child->ch...
Config = { 'game': { 'height': 640, 'width': 800, 'tile_width': 32 }, 'resources': { 'sprites': { 'player': "src/res/char.png" } } }
config = {'game': {'height': 640, 'width': 800, 'tile_width': 32}, 'resources': {'sprites': {'player': 'src/res/char.png'}}}
def find_binary_partitioned_seat(seat_range, input_text): for letter in input_text: difference = abs(seat_range[0] - seat_range[1]) // 2 if (letter == "F") or (letter == "L"): seat_range = [seat_range[0], seat_range[0] + difference] else: seat_range = [seat_range[1] -...
def find_binary_partitioned_seat(seat_range, input_text): for letter in input_text: difference = abs(seat_range[0] - seat_range[1]) // 2 if letter == 'F' or letter == 'L': seat_range = [seat_range[0], seat_range[0] + difference] else: seat_range = [seat_range[1] - dif...
f = open('input.txt', 'r') row = f.read() data = row.split() result = 0 children = {0: 1} metadata = {} deep = 1 slot = 2 for i in data: i = int(i) if slot == 2 and children[deep - 1] > 0 and (deep not in metadata or metadata[deep] == 0): children[deep] = i children[deep - 1] -= 1 slot ...
f = open('input.txt', 'r') row = f.read() data = row.split() result = 0 children = {0: 1} metadata = {} deep = 1 slot = 2 for i in data: i = int(i) if slot == 2 and children[deep - 1] > 0 and (deep not in metadata or metadata[deep] == 0): children[deep] = i children[deep - 1] -= 1 slot =...
class Event: def __init__(self, time): self.time = time def __lt__(self, other): return self.time < other.time def __le__(self, other): return self < other or self.time == other.time class InjectEvent(Event): def __init__(self, time, packet): super(InjectEvent, self).__init__(time) self.packet = packet...
class Event: def __init__(self, time): self.time = time def __lt__(self, other): return self.time < other.time def __le__(self, other): return self < other or self.time == other.time class Injectevent(Event): def __init__(self, time, packet): super(InjectEvent, self)...
problems = input().split(";") count = 0 for problem in problems: if "-" in problem: upper = problem.split("-")[1] lower = problem.split("-")[0] count += int(upper) - int(lower) + 1 else: count += 1 print(count)
problems = input().split(';') count = 0 for problem in problems: if '-' in problem: upper = problem.split('-')[1] lower = problem.split('-')[0] count += int(upper) - int(lower) + 1 else: count += 1 print(count)
# game states IN_PROGRESS = 0 PLAYER1 = 1 PLAYER2 = 2 DRAW = 3 GAME_STATES = {"IN_PROGRESS": IN_PROGRESS, "PLAYER1": PLAYER1, "PLAYER2": PLAYER2, "DRAW": DRAW}
in_progress = 0 player1 = 1 player2 = 2 draw = 3 game_states = {'IN_PROGRESS': IN_PROGRESS, 'PLAYER1': PLAYER1, 'PLAYER2': PLAYER2, 'DRAW': DRAW}
# Do not edit. bazel-deps autogenerates this file from maven_deps.yaml. def declare_maven(hash): native.maven_jar( name = hash["name"], artifact = hash["artifact"], sha1 = hash["sha1"], repository = hash["repository"] ) native.bind( name = hash["bind"], actua...
def declare_maven(hash): native.maven_jar(name=hash['name'], artifact=hash['artifact'], sha1=hash['sha1'], repository=hash['repository']) native.bind(name=hash['bind'], actual=hash['actual']) def maven_dependencies(callback=declare_maven): callback({'artifact': 'args4j:args4j:2.33', 'lang': 'java', 'sha1':...
def zebra_2(x,y): pattern=["/","/","/","-","-","-"] z=0 while z<y: for i in range(0,x): print(pattern[i % len(pattern)], end='') z+=1 print("\n") x=int(input("give me a number of charcters in the row:" )) y=int(input("give me a number of rows:" )) zebra_2(x,y)
def zebra_2(x, y): pattern = ['/', '/', '/', '-', '-', '-'] z = 0 while z < y: for i in range(0, x): print(pattern[i % len(pattern)], end='') z += 1 print('\n') x = int(input('give me a number of charcters in the row:')) y = int(input('give me a number of rows:')) zebra_2...
weather_appid = "12345678" weather_appsecret = "abcdefg" baidu_map_ak = "dfjkal;fjalskf;as"
weather_appid = '12345678' weather_appsecret = 'abcdefg' baidu_map_ak = 'dfjkal;fjalskf;as'
first, second, year = map(int, input().split()) if first == second: print(1) elif first < 13 and second < 13: print(0) else: print(1)
(first, second, year) = map(int, input().split()) if first == second: print(1) elif first < 13 and second < 13: print(0) else: print(1)
# Converts the rows of data, with the specified # headers, into an easily human readable csv string. def readable_csv(rows, headers, digits=None): if digits is not None: for i, row in enumerate(rows): for j, col in enumerate(row): if isinstance(col, float): rows[i][j] = round(col, digits) # First, stri...
def readable_csv(rows, headers, digits=None): if digits is not None: for (i, row) in enumerate(rows): for (j, col) in enumerate(row): if isinstance(col, float): rows[i][j] = round(col, digits) rows = [[str(c) for c in row] for row in rows] widths = [ma...
class PLSR_SSS_Helper(object): def __init__(self,train_data,X,mse,msemin,component,y,y_c,y_cv,attribute,importance, prediction,dir_path,reportpath,prediction_map,modelsavepath,img_path,tran_path): self.train_data = train_data self.X = X self.mse = mse self.msemin = ...
class Plsr_Sss_Helper(object): def __init__(self, train_data, X, mse, msemin, component, y, y_c, y_cv, attribute, importance, prediction, dir_path, reportpath, prediction_map, modelsavepath, img_path, tran_path): self.train_data = train_data self.X = X self.mse = mse self.msemin = m...
# Symmetric Difference # Problem Link: https://www.hackerrank.com/challenges/symmetric-difference/problem m = int(input()) marr = set(map(int, input().split())) n = int(input()) narr = set(map(int, input().split())) for x in sorted(marr ^ narr): print(x)
m = int(input()) marr = set(map(int, input().split())) n = int(input()) narr = set(map(int, input().split())) for x in sorted(marr ^ narr): print(x)
class Scene: def __init__(self, camera, shapes, materials, lights): self.camera = camera self.shapes = shapes self.materials = materials self.lights = lights
class Scene: def __init__(self, camera, shapes, materials, lights): self.camera = camera self.shapes = shapes self.materials = materials self.lights = lights
# https://leetcode.com/problems/climbing-stairs/ class Solution: # def climbStairs(self, n: int) -> int: # array = [1, 2] # for i in range(2, n+1): # array.append(array[i-1] + array[i-2]) # return array[n-1] def climbStairs(self, n: int) -> int: if n <= 2: ...
class Solution: def climb_stairs(self, n: int) -> int: if n <= 2: return n (f1, f2, f3) = (1, 2, 3) for i in range(3, n + 1): f3 = f1 + f2 f1 = f2 f2 = f3 return f3 print(solution().climbStairs(1)) print(solution().climbStairs(2)) prin...
# HAUL Resources def get(i): return None def use(filename): # Do nothing, it is overridden when testing; in order to load resources at runtime return -1
def get(i): return None def use(filename): return -1
def failure_message(message=None, user=None, user_group=None): resp = '''Message failed to send, please try again later or contact administrator from: Broadcast Admin - Only you can see this message ''' return resp
def failure_message(message=None, user=None, user_group=None): resp = 'Message failed to send, please try again later or contact administrator\n from: Broadcast Admin\n - Only you can see this message\n ' return resp
n_str = input() n = int(n_str) if (n == 1): print(1.000000000000) else: sum = 0.000000000000 for i in range(1, n+1): sum += round((1.000000000000)/i, 12) print(sum)
n_str = input() n = int(n_str) if n == 1: print(1.0) else: sum = 0.0 for i in range(1, n + 1): sum += round(1.0 / i, 12) print(sum)
class Redirect: def __init__(self, url: str = ""): self.redirect_url = url def to_dict(self): tmp_dict = { "redirect_url": self.redirect_url, } return tmp_dict
class Redirect: def __init__(self, url: str=''): self.redirect_url = url def to_dict(self): tmp_dict = {'redirect_url': self.redirect_url} return tmp_dict
#!/usr/bin/python array = [0] * 43 Top = 1 Bottom = 2 Far = 4 Near = 8 Left = 16 Right = 32 scopeName = 'FDataConstants::' #Edge map array[Top + Far] = 'TopFar' array[Top + Near] = 'TopNear' array[Top + Left] = 'FTopLeft' array[Top + Right] = 'TopRigh...
array = [0] * 43 top = 1 bottom = 2 far = 4 near = 8 left = 16 right = 32 scope_name = 'FDataConstants::' array[Top + Far] = 'TopFar' array[Top + Near] = 'TopNear' array[Top + Left] = 'FTopLeft' array[Top + Right] = 'TopRight' array[Bottom + Far] = 'BottomFar' array[Bottom + Near] = 'BottomNear' array[Bottom + Left] = ...
class Website(object): def __init__(self, site): self.URL = site class Internet(object): def __init__(self): self.url_list = dict() def add_url(self, website): if website.URL in self.url_list: self.url_list[website.URL] += 1 else: self.url_list[webs...
class Website(object): def __init__(self, site): self.URL = site class Internet(object): def __init__(self): self.url_list = dict() def add_url(self, website): if website.URL in self.url_list: self.url_list[website.URL] += 1 else: self.url_list[web...
max= 0 a = 2 b = 3 if a < b: max= b if b < a: max= a assert (max == a or max == b) and max >= a and max >= b
max = 0 a = 2 b = 3 if a < b: max = b if b < a: max = a assert (max == a or max == b) and max >= a and (max >= b)
def rotateLeft(array_list , num_rotate ): alist = list(array_list) rotated_list = alist[num_rotate :]+alist[:num_rotate ] return rotated_list array_list = [] n = int(input("Enter number of elements in array list : ")) for i in range(0, n): elem = int(input()) array_list.append(elem) num_rotate=int...
def rotate_left(array_list, num_rotate): alist = list(array_list) rotated_list = alist[num_rotate:] + alist[:num_rotate] return rotated_list array_list = [] n = int(input('Enter number of elements in array list : ')) for i in range(0, n): elem = int(input()) array_list.append(elem) num_rotate = int(...
#createMinMaxFunction.py def minimum_value(lst): #check if any ints or floats are in the list type_list = check_list_types(lst) #if not, return error if float not in type_list and int not in type_list: return "error" # if not create check every value in list against the value assigned to mi...
def minimum_value(lst): type_list = check_list_types(lst) if float not in type_list and int not in type_list: return 'error' minimum = float('inf') for val in lst: try: if val < minimum: minimum = val except: return_operator_error(val) ...
def main(): n = int(input()) p = [] for _ in range(n): p.append(input()) k = p.copy() k.sort() # print(k, p) if k == p: print("INCREASING") return # print(reversed(k), p, reversed(k) == p) if list(reversed(k)) == p: print("DECREASING")...
def main(): n = int(input()) p = [] for _ in range(n): p.append(input()) k = p.copy() k.sort() if k == p: print('INCREASING') return if list(reversed(k)) == p: print('DECREASING') else: print('NEITHER') return if __name__ == '__main__': mai...
nome = input('Qual o seu nome? ') sobrenome = input('Qual o seu sobrenome? ') print('Seja bem-vindo(a), {} {}!'.format(nome, sobrenome)) print('Ordem natural: {0} {1}'.format(nome, sobrenome)) print('Ordem inversa: {1} {0}'.format(nome, sobrenome)) print('Outra forma: {0} {1} {other}'.format(nome, sobrenome, other = 'S...
nome = input('Qual o seu nome? ') sobrenome = input('Qual o seu sobrenome? ') print('Seja bem-vindo(a), {} {}!'.format(nome, sobrenome)) print('Ordem natural: {0} {1}'.format(nome, sobrenome)) print('Ordem inversa: {1} {0}'.format(nome, sobrenome)) print('Outra forma: {0} {1} {other}'.format(nome, sobrenome, other='San...
# import time # import os # import stat # import random # import string # # import pytest # # import cattle # # from kubernetes import client as k8sclient, config as k8sconfig # BASE_URL = "http://%ip%:9333/v1" token = "" fqdn = "" create_param = { 'fqdn': '', 'hosts': ["1.1.1.1", "2.2.2.2"] } update_param = ...
base_url = 'http://%ip%:9333/v1' token = '' fqdn = '' create_param = {'fqdn': '', 'hosts': ['1.1.1.1', '2.2.2.2']} update_param = {'fqdn': '', 'hosts': ['3.3.3.3']} def set_token_fqdn(result): global token, fqdn token = result['token'] fqdn = result['data']['fqdn'] def get_token_fqdn(): return (token,...
a, b, i = 0, 1, 2 fibo = [a, b] while i < 100: i = i + 1 a, b = b, a+b fibo.append(b)
(a, b, i) = (0, 1, 2) fibo = [a, b] while i < 100: i = i + 1 (a, b) = (b, a + b) fibo.append(b)
# Recursive solution for permutation class Solution: def permute(self, nums: List[int]) -> List[List[int]]: result = [] self.permu_helper(nums, [], result) return result def permu_helper(self, new_list, temp, result): if len(new_list) == 0: result.append(temp) ...
class Solution: def permute(self, nums: List[int]) -> List[List[int]]: result = [] self.permu_helper(nums, [], result) return result def permu_helper(self, new_list, temp, result): if len(new_list) == 0: result.append(temp) return for i in range(...
rankDict = { '1': 'A', '11': 'J', '12': 'Q', '13': 'K' } class Rank: def __init__(self, number): if not (1 <= number <= 13): raise Exception("number is out of range") self.number = number def __str__(self): return rankDict.get(str(self.number), str(self.number))
rank_dict = {'1': 'A', '11': 'J', '12': 'Q', '13': 'K'} class Rank: def __init__(self, number): if not 1 <= number <= 13: raise exception('number is out of range') self.number = number def __str__(self): return rankDict.get(str(self.number), str(self.number))
def server(host, port, symmetricKey): sockVanilla = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sockVanilla.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sockVanilla.bind((host, port)) sockVanilla.listen(5) while True: sockClientVanilla, source = sockVanilla.accept() ...
def server(host, port, symmetricKey): sock_vanilla = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sockVanilla.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sockVanilla.bind((host, port)) sockVanilla.listen(5) while True: (sock_client_vanilla, source) = sockVanilla.accept() ...
name_list= ['Sharon','Mic','Josh','Hannah','Hansel'] height_list = [172,166,187,200,166] weight_list = [59.5,65.6,49.8,64.2,47.5] size_list = ['M','L','S','M','S'] bmi_list = [] for i in range(len(name_list)): bmi = weight_list[i]/((height_list[i]/100)**2) bmi_list.append('{:.2f}'.format(bmi)) print("{:<10} {...
name_list = ['Sharon', 'Mic', 'Josh', 'Hannah', 'Hansel'] height_list = [172, 166, 187, 200, 166] weight_list = [59.5, 65.6, 49.8, 64.2, 47.5] size_list = ['M', 'L', 'S', 'M', 'S'] bmi_list = [] for i in range(len(name_list)): bmi = weight_list[i] / (height_list[i] / 100) ** 2 bmi_list.append('{:.2f}'.format(bm...
def get_fuel(fuel): fuel = ((fuel // 3) - 2) if fuel <= 0: return 0 return fuel + get_fuel(fuel) total = 0 with open("d1.txt", "r") as f: for line in f: total += get_fuel(int(line)) print(total)
def get_fuel(fuel): fuel = fuel // 3 - 2 if fuel <= 0: return 0 return fuel + get_fuel(fuel) total = 0 with open('d1.txt', 'r') as f: for line in f: total += get_fuel(int(line)) print(total)
def impares_no_intervalo(intervalo: tuple, lista: list): inicial, final = intervalo return [numero for numero in lista if numero % 2 != 0 and inicial <= numero <= final] limite = (0,10) l = [-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] # --- OUTPUT --- # [1, 3, 5, 7, 9] print(impares_no_intervalo(...
def impares_no_intervalo(intervalo: tuple, lista: list): (inicial, final) = intervalo return [numero for numero in lista if numero % 2 != 0 and inicial <= numero <= final] limite = (0, 10) l = [-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] print(impares_no_intervalo(limite, l))
# -- coding:utf-8-- class DL(object): def __init__(self): self.dlcs = 0 def q(self): self.dlcs = self.dlcs + 1 print(str(self.dlcs)) def a(self): self.dlcs = 0 print(str(self.dlcs)) hi = DL() hi.q() hi.q() hi.q() hi.q() hi.q() hi.a()
class Dl(object): def __init__(self): self.dlcs = 0 def q(self): self.dlcs = self.dlcs + 1 print(str(self.dlcs)) def a(self): self.dlcs = 0 print(str(self.dlcs)) hi = dl() hi.q() hi.q() hi.q() hi.q() hi.q() hi.a()
# # This file contains the Python code from Program 8.20 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm08_20.txt # class OpenScatterT...
class Openscattertablev2(OpenScatterTable): def withdraw(self, obj): if self._count == 0: raise ContainerEmpty i = self.findInstance(obj) if i < 0: raise KeyError while True: j = (i + 1) % len(self) while self._array[j]._state == self....
# CodeWars Count_Of_Positives_/_Sum_Of_Negatives def count_positives_sum_negatives(arr): null_list = [] sum_of_positives = 0 sum_of_negatives = 0 if arr == [0, 0] or arr == []: return null_list for i in arr: if i > 0: sum_of_positives += 1 elif i < 0: ...
def count_positives_sum_negatives(arr): null_list = [] sum_of_positives = 0 sum_of_negatives = 0 if arr == [0, 0] or arr == []: return null_list for i in arr: if i > 0: sum_of_positives += 1 elif i < 0: sum_of_negatives += i else: c...
class Student: email = 'default@redi-school.org' def __init__(self, name, birthday, courses): # class public attributes self.full_name = name self.first_name = name.split(' ')[0] self.birthday = birthday self.courses = courses self.attendance = [] # Objects joh...
class Student: email = 'default@redi-school.org' def __init__(self, name, birthday, courses): self.full_name = name self.first_name = name.split(' ')[0] self.birthday = birthday self.courses = courses self.attendance = [] john = student('John Schneider', '2010-04-05', ['...
# Task # Given sets of integers, M and N, print their symmetric difference in ascending order. # The term symmetric difference indicates those values that exist in either M or N but do not # exist in both. # # Input Format # The first line of input contains an integer, M. # The second line contains M space-separated i...
(m, m_set) = (int(input()), set(input().split())) (n, n_set) = (int(input()), set(input().split())) values_in_m = m_set.difference(n_set) values_in_n = n_set.difference(m_set) m_union_n = values_in_m.union(values_in_n) for number in sorted((int(i) for i in m_union_n)): print(number)
SOC_IRAM_LOW = 0x4037c000 SOC_IRAM_HIGH = 0x403e0000 SOC_DRAM_LOW = 0x3fc80000 SOC_DRAM_HIGH = 0x3fce0000 SOC_RTC_DRAM_LOW = 0x50000000 SOC_RTC_DRAM_HIGH = 0x50002000 SOC_RTC_DATA_LOW = 0x50000000 SOC_RTC_DATA_HIGH = 0x50002000
soc_iram_low = 1077395456 soc_iram_high = 1077805056 soc_dram_low = 1070071808 soc_dram_high = 1070465024 soc_rtc_dram_low = 1342177280 soc_rtc_dram_high = 1342185472 soc_rtc_data_low = 1342177280 soc_rtc_data_high = 1342185472
class Node: def __init__(self, data, next=None): self.data = data self.next = next class LinkedList: def __init__(self): self.head = None def insert_first(self, data): node = Node(data, self.head) self.head = node def __repr__(self): return str(sel...
class Node: def __init__(self, data, next=None): self.data = data self.next = next class Linkedlist: def __init__(self): self.head = None def insert_first(self, data): node = node(data, self.head) self.head = node def __repr__(self): return str(self.h...
# [Grand Athenaeum] sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.sendNext("Supposedly the White Mage was last seen in Ellin Forest. If that's true, there must be evidence.") sm.sendSay("Ephenia the Fairy Queen's dwelling is nearby. I'll see if she knows anything.") sm.startQuest(parentID)
sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.sendNext("Supposedly the White Mage was last seen in Ellin Forest. If that's true, there must be evidence.") sm.sendSay("Ephenia the Fairy Queen's dwelling is nearby. I'll see if she knows anything.") sm.startQuest(parentID)
# reference.py # This script is for image references cookieurl = ["https://media1.tenor.com/images/45fe45f75ec523c2abf4e75ca2ac2fe2/tenor.gif?itemid=11797931", "https://media1.tenor.com/images/de6a49b999216fbda779cd27a24919c3/tenor.gif?itemid=19073253"] cookiesurl = ["https://media1.tenor.com/images/30c8c...
cookieurl = ['https://media1.tenor.com/images/45fe45f75ec523c2abf4e75ca2ac2fe2/tenor.gif?itemid=11797931', 'https://media1.tenor.com/images/de6a49b999216fbda779cd27a24919c3/tenor.gif?itemid=19073253'] cookiesurl = ['https://media1.tenor.com/images/30c8ce96272fe73f58841164a179f6d1/tenor.gif?itemid=17729544', 'https://me...
def D(): n = int(input()) neighbours = [None] #Asi puedo manejar numero de personas como index for i in range(n): neighbours.append([int(x) for x in input().split()]) visited = set() ans = [None,1] visited.add(1) a , b = neighbours[1][0] , neighbours[1][1] if(b in neighbours[a]): ans+=[a,b] else: ans...
def d(): n = int(input()) neighbours = [None] for i in range(n): neighbours.append([int(x) for x in input().split()]) visited = set() ans = [None, 1] visited.add(1) (a, b) = (neighbours[1][0], neighbours[1][1]) if b in neighbours[a]: ans += [a, b] else: ans +=...
# Count total cars per company # My Solution df.groupby('company').count() # Given Solution df['company'].value_counts()
df.groupby('company').count() df['company'].value_counts()
''' Python Program to Remove the Duplicate Items from a List ''' lst = [3,5,2,7,5,4,3,7,8,2,5,4,7,2,1] print(lst) def method(): new_lst = [] for item in lst: if item not in new_lst: new_lst.append(item) print(new_lst) method()
""" Python Program to Remove the Duplicate Items from a List """ lst = [3, 5, 2, 7, 5, 4, 3, 7, 8, 2, 5, 4, 7, 2, 1] print(lst) def method(): new_lst = [] for item in lst: if item not in new_lst: new_lst.append(item) print(new_lst) method()
# this module is the template of all environment in this project # some basic and common features are listed in this class class ENVError(Exception): def __init__(self, value_): self.__value = value_ def __str__(self): print('Environment error occur: ' + self.__value) class ENV: def __ini...
class Enverror(Exception): def __init__(self, value_): self.__value = value_ def __str__(self): print('Environment error occur: ' + self.__value) class Env: def __init__(self): pass def reset(self): raise env_error('You have not defined the reset function of environm...
C_ENDINGS = ('.c', '.i', ) CXX_ENDINGS = ('.cpp', '.cxx', '.cc', '.c++', '.CPP', '.CXX', '.C', '.CC', '.C++', '.ii', ) OBJC_ENDINGS = ('.m', '.mi', ) OBJCXX_ENDINGS = ('.mm', '.mii', ) FORTRAN_ENDINGS = ('.f', '.for', '.ftn', '.f77', '.f90', '.f95', '.f03', '.f08', '.F', '.FOR', '.FTN', '.F77', '.F90', '.F95',...
c_endings = ('.c', '.i') cxx_endings = ('.cpp', '.cxx', '.cc', '.c++', '.CPP', '.CXX', '.C', '.CC', '.C++', '.ii') objc_endings = ('.m', '.mi') objcxx_endings = ('.mm', '.mii') fortran_endings = ('.f', '.for', '.ftn', '.f77', '.f90', '.f95', '.f03', '.f08', '.F', '.FOR', '.FTN', '.F77', '.F90', '.F95', '.F03', '.F08') ...
#Python solution for AoC qn 2 f = open("2.txt","r") strings = f.readlines() #Part 1 freq_total = { "2":0, "3":0 } for s in strings: s = s.strip().lower() freq_indv = {} #Count how many of each letter is inside for ch in s: if ch in freq_indv: freq_indv[ch]+=1 el...
f = open('2.txt', 'r') strings = f.readlines() freq_total = {'2': 0, '3': 0} for s in strings: s = s.strip().lower() freq_indv = {} for ch in s: if ch in freq_indv: freq_indv[ch] += 1 else: freq_indv[ch] = 1 found = {'2': False, '3': False} for ch in freq_indv...
class Solution: @staticmethod def naive(prices): maxReturn = 0 minVal = prices[0] for i in range(1,len(prices)): if prices[i]-minVal > maxReturn: maxReturn = prices[i]-minVal if prices[i]<minVal: minVal = prices[i] return m...
class Solution: @staticmethod def naive(prices): max_return = 0 min_val = prices[0] for i in range(1, len(prices)): if prices[i] - minVal > maxReturn: max_return = prices[i] - minVal if prices[i] < minVal: min_val = prices[i] ...
''' subsets and subarrays subarrays: a = [10,20,30] => [ [10], [20], [30] [10,20], [10,20,30], [20,30], ] subsets: a = [10,20,30] => [ [], [10,20,30] [10], [20], [30], [10, 20], [10, 30], [20, 30] ] ''' def print_subsets(a): limit = 2 ** len(a) for i in ra...
""" subsets and subarrays subarrays: a = [10,20,30] => [ [10], [20], [30] [10,20], [10,20,30], [20,30], ] subsets: a = [10,20,30] => [ [], [10,20,30] [10], [20], [30], [10, 20], [10, 30], [20, 30] ] """ def print_subsets(a): limit = 2 ** len(a) for i in r...
# -*- coding: utf-8 -*- # blue to red diverging set blue_to_red_diverging = ['#d7191c', '#fdae61', '#ffffbf', '#abd9e9', '#2c7bb6'] # red oragne sequential single hue: orange_sequential = ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'] # blue s...
blue_to_red_diverging = ['#d7191c', '#fdae61', '#ffffbf', '#abd9e9', '#2c7bb6'] orange_sequential = ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'] blue_sequential = ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'] mp...
''' Author : Hemant Rana Date : 30th Aug 2020 link : https://leetcode.com/problems/container-with-most-water ''' class Solution: def maxArea(self, height: List[int]) -> int: h_len=len(height) max_area=0 b,e=0,h_len-1 while(b<e): area=min(height[b],height[e])*(e-...
""" Author : Hemant Rana Date : 30th Aug 2020 link : https://leetcode.com/problems/container-with-most-water """ class Solution: def max_area(self, height: List[int]) -> int: h_len = len(height) max_area = 0 (b, e) = (0, h_len - 1) while b < e: area = min(height[b], hei...
class Struct(object): def __init__(self, data=None, **kwds): if not data: data = {} for name, value in data.items(): if name: setattr(self, name, self._wrap(value)) for name, value in kwds.items(): if name: setattr(self, nam...
class Struct(object): def __init__(self, data=None, **kwds): if not data: data = {} for (name, value) in data.items(): if name: setattr(self, name, self._wrap(value)) for (name, value) in kwds.items(): if name: setattr(self...
##To find the kth maximum number in an array. lst=[] len=int(input("Enter the length of the array.\n")) for i in range(0,len): e=input("Enter the element.\n") lst.append(e) k=int(input("Enter the value of k\n")) lst.sort(reverse=True) f=k-1 print(lst[f])
lst = [] len = int(input('Enter the length of the array.\n')) for i in range(0, len): e = input('Enter the element.\n') lst.append(e) k = int(input('Enter the value of k\n')) lst.sort(reverse=True) f = k - 1 print(lst[f])
# create a list of movies list_of_movies = None list_of_movies = [ 'Toy Story', 'Lion King', 'Coco' ] # cycle through each movie title in the list of movies # starting from the first item and ending at the last item for movie_title in list_of_movies: print('***{}***'.format(movie...
list_of_movies = None list_of_movies = ['Toy Story', 'Lion King', 'Coco'] for movie_title in list_of_movies: print('***{}***'.format(movie_title)) word = '' for letter in movie_title: print(' {}'.format(letter)) word += letter print('The letters create the word variable >>{}'.format(wor...
''' Run through and ensure that all the required programs are installed on the system and functioning '''
""" Run through and ensure that all the required programs are installed on the system and functioning """
def solution(n, computers): def dfs(n, s, metrix, visited): stack = [s] visited.add(s) while stack: this = stack[-1] remove = True for i in range(n): if this == i: continue if i in visited: ...
def solution(n, computers): def dfs(n, s, metrix, visited): stack = [s] visited.add(s) while stack: this = stack[-1] remove = True for i in range(n): if this == i: continue if i in visited: ...
def is_paired(input_string: str) -> bool: input_string = clean_input_string(input_string) if len(input_string) % 2 != 0: return False while input_string: if not remove_bracket(input_string[0], input_string): return False return True def remove_bracket(bracket: str, inpu...
def is_paired(input_string: str) -> bool: input_string = clean_input_string(input_string) if len(input_string) % 2 != 0: return False while input_string: if not remove_bracket(input_string[0], input_string): return False return True def remove_bracket(bracket: str, input_str...
def test_oops(client): url = f'/fake-path' response = client.get(url) assert response.status_code == 404
def test_oops(client): url = f'/fake-path' response = client.get(url) assert response.status_code == 404
#-*- coding: utf-8 -*- class ValueDefinition: str_val_dict = {} val_str_dict = {} @classmethod def get(cls, data): if not cls.val_str_dict: cls.val_str_dict = dict(zip(cls.str_val_dict.values(), cls.str_val_dict.keys())) if type(data) == str: return cls.str_val_d...
class Valuedefinition: str_val_dict = {} val_str_dict = {} @classmethod def get(cls, data): if not cls.val_str_dict: cls.val_str_dict = dict(zip(cls.str_val_dict.values(), cls.str_val_dict.keys())) if type(data) == str: return cls.str_val_dict.get(data) e...
strip_words = [ 'Kind', 'MAE', 'Pandemisch' ] skip_names = [ 'Water' ] ignore_names = [ 'alfalfa', 'ali', 'belladonna', 'cold', 'drank', 'gas', 'hot', 'linn', 'sepia', 'skin', 'slow', 'stol', 'ultra', 'vicks', 'vitamine', 'yasmin' ] # re...
strip_words = ['Kind', 'MAE', 'Pandemisch'] skip_names = ['Water'] ignore_names = ['alfalfa', 'ali', 'belladonna', 'cold', 'drank', 'gas', 'hot', 'linn', 'sepia', 'skin', 'slow', 'stol', 'ultra', 'vicks', 'vitamine', 'yasmin']
#!/usr/bin/env python esInputs = "/home/matthieu/.emulationstation/es_input.cfg" esSettings = '/home/matthieu/.emulationstation/es_settings.cfg' recalboxConf = "/home/matthieu/recalbox/recalbox.conf" retroarchRoot = "/home/matthieu/recalbox/configs/retroarch" retroarchCustom = retroarchRoot + '/retroarchcustom.cfg' r...
es_inputs = '/home/matthieu/.emulationstation/es_input.cfg' es_settings = '/home/matthieu/.emulationstation/es_settings.cfg' recalbox_conf = '/home/matthieu/recalbox/recalbox.conf' retroarch_root = '/home/matthieu/recalbox/configs/retroarch' retroarch_custom = retroarchRoot + '/retroarchcustom.cfg' retroarch_custom_ori...
def set_timer(): # WIP pass
def set_timer(): pass
class Stack: def __init__(self): self.data = [] def push(self, value): self.data.append(value) def pop(self): return self.data.pop() def peek(self): if len(self.data) > 0: return self.data[-1:][0] else: return None def size(self): ...
class Stack: def __init__(self): self.data = [] def push(self, value): self.data.append(value) def pop(self): return self.data.pop() def peek(self): if len(self.data) > 0: return self.data[-1:][0] else: return None def size(self): ...
class Ingredient(): def __init__(self, amount, unit, name): self.amount = self.convert_to_decimal(amount) self.unit = unit self.name = name def convert_to_decimal(self, amount): try: return float(amount) except ValueError: num, denom = amount.split('/') return float(num) ...
class Ingredient: def __init__(self, amount, unit, name): self.amount = self.convert_to_decimal(amount) self.unit = unit self.name = name def convert_to_decimal(self, amount): try: return float(amount) except ValueError: (num, denom) = amount.spl...
# Return the Nth Even Number # nthEven(1) //=> 0, the first even number is 0 # nthEven(3) //=> 4, the 3rd even number is 4 (0, 2, 4) # nthEven(100) //=> 198 # nthEven(1298734) //=> 2597466 # The input will not be 0. def nth_even(n): return 2 * (n - 1) def test_nth_even(): assert nth_even(1) == 0 assert ...
def nth_even(n): return 2 * (n - 1) def test_nth_even(): assert nth_even(1) == 0 assert nth_even(2) == 2 assert nth_even(3) == 4 assert nth_even(100) == 198 assert nth_even(1298734) == 2597466
# https://www.codechef.com/problems/GOODBAD for T in range(int(input())): l,k=map(int,input().split()) s,c,b=input(),0,0 for i in s: if(i>='A' and i<='Z'): c+=1 if(i>='a' and i<='z'): b+=1 if(c<=k and b<=k): print("both") elif(c<=k): print("chef") elif(b<=k): print("brother") ...
for t in range(int(input())): (l, k) = map(int, input().split()) (s, c, b) = (input(), 0, 0) for i in s: if i >= 'A' and i <= 'Z': c += 1 if i >= 'a' and i <= 'z': b += 1 if c <= k and b <= k: print('both') elif c <= k: print('chef') elif b...
# class Tree: # def __init__(self, val, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: treeSum = 0 def solve(self, root): def preOrder(root): if root: self.treeSum += root.val preO...
class Solution: tree_sum = 0 def solve(self, root): def pre_order(root): if root: self.treeSum += root.val pre_order(root.right) pre_order(root.left) return root pre_order(root) return self.treeSum
class Service: def __init__(self, name, connector_func, state_processor_method=None, batch_size=1, tags=None, names_previous_services=None, names_required_previous_services=None, workflow_formatter=None, dialog_formatter=None, response_formatter=None, ...
class Service: def __init__(self, name, connector_func, state_processor_method=None, batch_size=1, tags=None, names_previous_services=None, names_required_previous_services=None, workflow_formatter=None, dialog_formatter=None, response_formatter=None, label=None): self.name = name self.batch_size =...
text = input() command = input() while command != 'Decode': current_command = command.split('|') action = current_command[0] if action == 'Move': num_of_letters = int(current_command[1]) substring = text[:num_of_letters] text = text[num_of_letters:] + substring elif action ==...
text = input() command = input() while command != 'Decode': current_command = command.split('|') action = current_command[0] if action == 'Move': num_of_letters = int(current_command[1]) substring = text[:num_of_letters] text = text[num_of_letters:] + substring elif action == 'In...
# To implement a stack using a list # Made by Nouman stack=[] def push(x): stack.append(x) print("Stack: ", stack) print(x," pushed into stack") def pop(): x=stack.pop() print("\nPopped: ",x) print("Stack :",stack) size=int(input("Enter size of stack: ")) print("\nEnter elements into stack: ") for i in range...
stack = [] def push(x): stack.append(x) print('Stack: ', stack) print(x, ' pushed into stack') def pop(): x = stack.pop() print('\nPopped: ', x) print('Stack :', stack) size = int(input('Enter size of stack: ')) print('\nEnter elements into stack: ') for i in range(size): x = int(input('\n...
class Solution: def wordPattern(self, pattern: str, s: str) -> bool: words = s.split(' ') if len(pattern) != len(words): return False w_to_p = {} p_to_w = {} for i, w in enumerate(words): if pattern[i] not in p_to_w: p_to_w[pattern[i]] = w if w not in ...
class Solution: def word_pattern(self, pattern: str, s: str) -> bool: words = s.split(' ') if len(pattern) != len(words): return False w_to_p = {} p_to_w = {} for (i, w) in enumerate(words): if pattern[i] not in p_to_w: p_to_w[pattern[...
class Solution: @staticmethod def naive(nums,target): left,right = 0,len(nums)-1 while right>left+1: mid = (left+right)//2 if nums[mid]>target: right = mid elif nums[mid]<target: left = mid else: retu...
class Solution: @staticmethod def naive(nums, target): (left, right) = (0, len(nums) - 1) while right > left + 1: mid = (left + right) // 2 if nums[mid] > target: right = mid elif nums[mid] < target: left = mid else...
# # PySNMP MIB module CISCO-WAN-MG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WAN-MG-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:02:23 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint, constraints_union) ...
#!/usr/local/bin/python3.3 def echo(message): print(message) return echo('Direct Call') x = echo x('Indirect Call') def indirect(func, arg): func(arg) indirect(echo, "Argument Call") schedule = [(echo, 'Spam'), (echo, 'Ham')] for (func, arg) in schedule: func(arg) def make(label): def echo(me...
def echo(message): print(message) return echo('Direct Call') x = echo x('Indirect Call') def indirect(func, arg): func(arg) indirect(echo, 'Argument Call') schedule = [(echo, 'Spam'), (echo, 'Ham')] for (func, arg) in schedule: func(arg) def make(label): def echo(message): print(label + '...
command = input() numbers = [int(x) for x in input().split()] parity = 0 if command == 'Even' else 1 result = sum(filter(lambda x: x % 2 == parity, numbers)) print(result * len(numbers))
command = input() numbers = [int(x) for x in input().split()] parity = 0 if command == 'Even' else 1 result = sum(filter(lambda x: x % 2 == parity, numbers)) print(result * len(numbers))
class ListNode: def __init__(self, data, link=None): self.data = data self.link = link
class Listnode: def __init__(self, data, link=None): self.data = data self.link = link
temperature =int(input("Enter Temperature: ")) if temperature > 30: print("It's a hot day") elif temperature < 10: print("It's a cold day") else: print("it's neither hot nor cold")
temperature = int(input('Enter Temperature: ')) if temperature > 30: print("It's a hot day") elif temperature < 10: print("It's a cold day") else: print("it's neither hot nor cold")
TRACKS = 'tracks' STUDIES = 'studies' EXPERIMENTS = 'experiments' SAMPLES = 'samples' SCHEMA_URL_PART1 = 'https://raw.githubusercontent.com/fairtracks/fairtracks_standard/' SCHEMA_URL_PART2 = '/current/json/schema/fairtracks.schema.json' TOP_SCHEMA_FN = 'fairtracks.schema.json' TERM_ID = 'term_id' ONTOLOGY = 'ontolo...
tracks = 'tracks' studies = 'studies' experiments = 'experiments' samples = 'samples' schema_url_part1 = 'https://raw.githubusercontent.com/fairtracks/fairtracks_standard/' schema_url_part2 = '/current/json/schema/fairtracks.schema.json' top_schema_fn = 'fairtracks.schema.json' term_id = 'term_id' ontology = 'ontology'...
class Constant(): def __init__(self, value): self._value = value def __call__(self): return self._value y = Constant(5) print((y()))
class Constant: def __init__(self, value): self._value = value def __call__(self): return self._value y = constant(5) print(y())
print(2, type(2)) print(3.5, type(3.5)) print([], type([])) print(True, type(True)) print(None, type(None)) # code to put in a for-each loop for the Pattern Loop Exercise
print(2, type(2)) print(3.5, type(3.5)) print([], type([])) print(True, type(True)) print(None, type(None))
def create_dimension_competitors(cursor): cursor.execute('''CREATE TABLE dimension_competitors ( company_name text, company_permalink text, competitor_name text, competitor_permalink text, extracted_at text )''')
def create_dimension_competitors(cursor): cursor.execute('CREATE TABLE dimension_competitors\n ( company_name text,\n company_permalink text,\n competitor_name text,\n competitor_permalink text,\n extracted_at text\n )')
name_1 = input() name_2 = input() delimiter = input() print(f"{name_1}{delimiter}{name_2}")
name_1 = input() name_2 = input() delimiter = input() print(f'{name_1}{delimiter}{name_2}')
def f(x): for i in reversed([20, 19, 18, 17, 16, 15, 14, 13, 12, 11]): if x % i != 0: return False return True i = 20 while f(i) == False: i += 20 print(i)
def f(x): for i in reversed([20, 19, 18, 17, 16, 15, 14, 13, 12, 11]): if x % i != 0: return False return True i = 20 while f(i) == False: i += 20 print(i)
a=int(input("Enter any number ")) for x in range(1,a+1): print(x)
a = int(input('Enter any number ')) for x in range(1, a + 1): print(x)
def pre_order(root): ret = [] stack, node = [], root while stack or node: if node: ret.append(node.val) stack.append(node) node = node.left else: node = stack.pop() node = node.right return ret def in_order(root): ret = []...
def pre_order(root): ret = [] (stack, node) = ([], root) while stack or node: if node: ret.append(node.val) stack.append(node) node = node.left else: node = stack.pop() node = node.right return ret def in_order(root): ret =...
# Keep a dictionary that has items ordered in a deque structure class DequeDict: # Entry that holds the key, value class DequeEntry: def __init__(self, key, value): self.key = key self.value = value self.prev = None self.next = None # Helpful for ...
class Dequedict: class Dequeentry: def __init__(self, key, value): self.key = key self.value = value self.prev = None self.next = None def __repr__(self): return '(k={}, v={})'.format(self.key, self.value) def __init__(self): ...
# # Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com) # # Jockey is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version. # # Jockey is distr...
def generate_doc(name, suffix='', append=0): if append: fp = open(name + '_doc.py', 'a+') else: fp = open(name + '_doc.py', 'w') fp.write('# automatically generated by generate_docs.py.\n') fp.write('doc' + suffix + '=" "\n') fp.close() generate_doc('area') generate_doc('arrow') ...
class Solution: def minTimeToVisitAllPoints(self, points: List[List[int]]) -> int: if not points or len(points) == 1: return 0 time = 0 for index,cur_point in enumerate(points): if index == len(points) - 1: return time next_point = points[i...
class Solution: def min_time_to_visit_all_points(self, points: List[List[int]]) -> int: if not points or len(points) == 1: return 0 time = 0 for (index, cur_point) in enumerate(points): if index == len(points) - 1: return time next_point =...