content
stringlengths
7
1.05M
def qt(a): res = 0 n = len(a) ldial, rdial = {}, {} threat = [] for i in range(n): j = a[i] threat.append(0) if i + j in ldial: threat[i] += 1 pre = ldial[i + j][-1] threat[pre] += 1 if threat[pre] == 4: return 4...
# https://leetcode.com/problems/maximum-population-year def maximum_population(logs): population_by_year = {} for [birth, death] in logs: for year in range(birth, death): if year in population_by_year: population_by_year[year] += 1 else: popu...
n=5 for i in range (n): for j in range (i,n-1): print(' ', end='') for k in range (i+1): print('* ', end='') for l in range (i+1, n): print(' ', end=' ') for m in range (i+1): print('* ', end='') print()
# Basic config for stuff that can be easily changed, but which is git-managed. # See also apikeys_sample.py for the configs which are _not_ git-managed. #server_domain = "http://www.infiniteglitch.net" server_domain = "http://50.116.55.59" http_port = 8888 # Port for the main web site, in debug mode renderer_port = 88...
# Definition for singly-linked list. class ListNode: def __init__(self, val): self.val = val self.next = None # the pointer node1 = ListNode(2) node2 = ListNode(5) node3 = ListNode(7) node1.next = node2 # 2->5 node2.next = node3 # 5->7 # the entire linked list : 2->5->7 while node1: pr...
#To Calculate Surface area of a cylinder #Formula = (2*3.14*r*h)+( 2*3.14*r*r) r=float(input('Enter the radius of the Cylinder: ')) h=float(input('Enter the height of the Cylinder: ')) SA= (2*3.14*r*h) + ( 2*3.14*r*r) print('The Surface Area is:', SA,'sq. m')
# see credits.txt aliceblue = "#F0F8FF" antiquewhite = "#FAEBD7" aqua = "#00FFFF" aquamarine = "#7FFFD4" azure = "#F0FFFF" beige = "#F5F5DC" bisque = "#FFE4C4" blanchedalmond = "#FFEBCD" blue = "#0000FF" blueviolet = "#8A2BE2" brown = "#A52A2A" burlywood = "#DEB887" cadetblue = "#5F9EA0" chocolate = "#D2691E" coral = ...
courses = {} line = input() while line != "end": course_info = line.split(" : ") type_course = course_info[0] student_name = course_info[1] courses.setdefault(type_course, []).append(student_name) line = input() sorted_courses = dict(sorted(courses.items(), key=lambda x: (-len(x[1])))) for curr...
def saveThePrisoner(n, m, s): if (m+s-1)%n==0: print(n) else: print((m+s-1)%n) if __name__ == '__main__': t = int(input()) for t_itr in range(t): nms = input().split() n = int(nms[0]) m = int(nms[1]) s = int(nms[2]) saveThePrisoner(n, m, s) ...
del_items(0x8009F828) SetType(0x8009F828, "void VID_OpenModule__Fv()") del_items(0x8009F8E8) SetType(0x8009F8E8, "void InitScreens__Fv()") del_items(0x8009F9D8) SetType(0x8009F9D8, "void MEM_SetupMem__Fv()") del_items(0x8009FA04) SetType(0x8009FA04, "void SetupWorkRam__Fv()") del_items(0x8009FA94) SetType(0x8009FA94, "...
xa = {1, 2, 31, 41, 5} pp = {1, 2, 3, 4, 5, 6} pp = xa.clear() # Complementary to Intersection print("XA:\n", xa, "\nPP:\n", pp)
def aumentar(preco = 0, taxa = 0, formato = False): resultado = preco + (preco * taxa/100) return resultado if formato is False else moeda(resultado) def diminuir(preco = 0, taxa = 0, formato = False): resultado = preco - (preco * taxa/100) return resultado if formato is False else moeda(resultado) ...
# -*- coding: utf-8 -*- """Top-level package for Docker Auto Labels.""" __author__ = """Sebastian Ramirez""" __email__ = 'tiangolo@gmail.com' __version__ = '0.2.3'
#--- Exercicio 2 - Variávies e impressão com interpolacão de string #--- Crie um menu para um sistema de cadastro de funcionários #--- O menu deve ser impresso com a função format() para concatenar os números da opções, que devem ser números inteiros #--- Alem das opções o menu deve conter um cabeçalho e um rodapé #--...
""" @generated cargo-raze generated Bazel file. DO NOT EDIT! Replaced on runs of cargo-raze """ load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") # buildifier: disable=load load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # buildifier: disable=load load("@bazel_tools//too...
""" Copyright 2020, Köhler Noah & Statz Andre, noah2472000@gmail.com andrestratz@web.de, All rights reserved. """ # :var colors: # colors is a dictionary. The Key is a string, who describes a color. # The value is a tuple, with three integers the value should be between 0 and 255. # Each of the i...
class ConnectionError(Exception): def __init__(self, response, content=None, message=None): self.response = response self.content = content self.message = message def __str__(self): message = "Failed." if hasattr(self.response, 'status_code'): message += " R...
class Solution(object): def maxDistToClosest(self, seats): # 用生成器存储有座位的坐标 people = (i for i, seat in enumerate(seats) if seat) # 分别存储当前位置最近的左侧和右侧有座位的坐标 prev, future = None, next(people) ans = 0 for i, seat in enumerate(seats): if seat: pre...
HOST = '0.0.0.0' PORT = '8160' #opencv supported formats IMAGE_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'jpe', 'jp2', 'bmp', 'dip', 'pbm', 'pgm', 'ppm', 'sr', 'ras', 'tiff', 'tif', 'exr'])
def unique_num(arr): new = [] for val in arr: if val not in new: new.append(val) return new print(unique_num([2, 3, 3, 2, 1, 4, 5]))
#Altere o programa anterior para mostrar no final a soma dos números n1 = int(input("Digite um número inteiro: ")) n2 = int(input("Digite outro número inteiro: ")) soma = 0 for n in range(n1+1,n2): print(n) soma += n print("A soma dos intervalos é de : {}".format(soma))
# Usage: # ip, status_code = parse_line(line) def parse_line(line): parts = line.split() return (parts[0], int(parts[8])) class AccessLog(object): def __init__(self, path_to_logfile): # TODO: Implement self.ip_set = set([]) self.status_count = {} # open file , do parse_lin...
class KafqaStoreNode: """ Implements a distributed key-value store's node. """ def __init__(self, name, host, port='80'): self.name = name self.host = host self.port = port self.hashtable = dict() self.reverse_lookup_hashtables = dict() return d...
# coding=utf-8 class message(object): '''Wrapper class for the messages sent in the blockchain. It has a header of type 'message_header' and a payload of type 'message_payload' The content type matches the message 'type' attribute''' def __init__(self, header, payload): self.check_types(header,...
class Vehicle: def __init__(self, type, model, price): self.type = type self.model = model self.price = price self.owner = None def buy(self, money: int, name: str): if self.price > money: return "Sorry, not enough money" elif self.owner: ...
def count_list(lists): count = 0 for num in lists: if num == 4: count += 1 return count new_list = [34, 4, 56, 4, 22] print (count_list(new_list))
# -*- coding: utf-8 -*- while True: res = 0 d = {} n = int(input()) if n == 0: break v = list(map(int, input().split())) for num in v: if str(num) not in d.keys(): d[str(num)] = 1 else: d[str(num)] += 1 for k in d: if d[...
# Author: Bhavith C # Python Programming print("Hello World!")
class AttachmentSchema: media_url: str filename: str dimensions: dict class Attachment: def __init__(self, attachment: AttachmentSchema, client): self.media_url = attachment.get("media_url") self.filename = attachment.get("filename") self.dimensions = attachment.get("...
""" Add datascience """ name = "20201030143800_add_datascience" dependencies = ["20201008172100_issue_name_index"] def upgrade(db): db.teams.insert_one({"name": "datascience"}) def downgrade(db): db.teams.delete_one({'name': 'datascience'})
{ "targets": [ { "include_dirs": [ "<!(node -e \"require('nan')\")" ], "cflags_cc": [ "-O2" ], "libraries": [ ], "target_name": "addon", "sources": [ ...
class Rect(object): def __init__(self, *args): try: if len(args) == 4: self.x, self.y, self.w, self.h = args elif len(args) == 2: self.x, self.y = args[0] self.w, self.h = args[1] else: raise Exception() ...
def Solve(board): board.Draw() find = Find_Empty(board) if not find: return True else: row, col = find for i in range(1, 10): if Valid(board, i, (row, col)): board.Get_Board()[row][col] = i if Solve(board): return True bo...
# parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '|\x03\xc9\x8fL\xea\xa0\xa2`v\xc7\xe5\xf6L\xd3\xd2' _lr_action_items = {'NUMBER':([3,8,12,15,33,35,39,40,43,50,52,54,55,56,57,58,63,64,65,67,68,69,71,73,74,76,77,78,79,80,81,82,83,84,85,86,...
def solution(A): counter = {} for num in range(1,len(A)+1): counter[num] = 0 for num in A: if num in counter: counter[num] += 1 if counter[num] > 1: return 0 else: return 0 return 1 A = [4, 1, 3, 2] solution(A)
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'test_db', 'USER':'postgres', 'PASSWORD': 'Cat.iquality@gmail.com', 'HOST': '127.0.0.1', 'PORT': '5432' } }
MAIN_SECTOR = [ 'Government', 'Private', 'NGO', 'Entrepreneur', 'Farmer', 'Student', 'Other', ] SUBSECTOR = [ 'Central Government', 'IAS', 'IPS', 'IFoS', 'Other UPSC Services', 'ICAR', 'State-Agriculture', 'State-Forestry', 'State-Revenue', 'State-Pol...
# # PySNMP MIB module COM21-HCXVOICE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/COM21-HCXVOICE-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:26:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
GET = 'GET' POST = 'POST' PUT = 'PUT' DELETE = 'DELETE'
#!/usr/bin/env python # Prasanna Sritharan, February 2019 # Adapted from Line Tweetbot by Mark Jordan, https://github.com/mjordan/linetweetbot #from tweepy import * """ Config variables """ # Set up authentication for this Twitter app. oa_access_token = '' oa_access_token_secret = '' consumer_key = '' consumer_sec...
SETTING_FILENAME = 'filename' SETTING_RECENT_FILES = 'recentFiles' SETTING_WIN_SIZE = 'window/size' SETTING_WIN_POSE = 'window/position' SETTING_WIN_GEOMETRY = 'window/geometry' SETTING_LINE_COLOR = 'line/color' SETTING_FILL_COLOR = 'fill/color' SETTING_ADVANCE_MODE = 'advanced' SETTING_WIN_STATE = 'window/state' SETTI...
# Source and destination file names. test_source = "data/math.txt" test_destination = "math_output_latex.html" # Keyword parameters passed to publish_file. reader_name = "standalone" parser_name = "rst" writer_name = "html" # Settings settings_overrides['math_output'] = 'latex' # local copy of default stylesheet: set...
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class BasicClusterInfo(object): """Implementation of the 'BasicClusterInfo' model. Specifies basic information about the Cohesity Cluster. Attributes: authentication_type (AuthenticationTypeEnum): Specifies the authentication sc...
A,B,C= input().split() if (A==B) and (B==C): print('Yes') else: print('No')
""" Utilities for handling English Language rules. """ def add_indefinite_article(phrase): """ Given a word, choose the appropriate indefinite article (e.g., "a" or "an") and add it the front of the word. Matches the original word's capitalization. Args: phrase (str): The phrase to get t...
def escreva(msg): print('^' * (len(msg) + 4)) print(f' {msg}') print('^' * (len(msg) + 4)) escreva('oii')
# x and y store the position of the ellipse x = 0 y = 0 # the x and y speed of the ellipse x_speed = 5 y_speed = 5 # the dimensions of the ellipse ellipse_width = 100 ellipse_height = 50 # setup gets called once def setup(): # the global keyword must be used as x and y are getting changed and they are global var...
print('Ingrese:') cadena=input() cadena=cadena.split(' ') terminales=['void','int','float','a','{','}','(',')','return','instrucciones'] no_terminales=['S','TipoDato','Identificador','Letra','RestoLetra','Retorno','$'] tabla = {"S":{"void":["void","Identificador","(",")","{","instrucciones","}"], "int":["T...
class Solution: def fractionToDecimal(self, a: int, b: int) -> str: if a % b == 0: return str(a // b) #整除 if a * b > 0: t = '' #处理符号 elif a * b < 0: t = '-' else: return '0' a = abs(a) b = abs(b) c = str(a // b) #整数部分 d = a % b z = {} #余数字...
class Tuple3d(): """docstring for Tuple3D""" x = 0.0 y = 0.0 z = 0.0 def __init__(self, x: float, y: float, z: float): self.x = x self.y = y self.z = z @classmethod def fromTuple3d(self, parent: "Tuple3d") -> "Tuple3d": return Tuple3d(parent.x, parent.y, pa...
def binary_search(arr: list, left: int, right: int, key: int) -> int: """Iterative Binary Search""" if left > right: return -1 while left <= right: mid = left + (right - left) // 2 if arr[mid] == key: return mid elif arr[mid] < key: left = mid + 1 ...
def saddle_points(m): if len(m) == 0: return set() if any(len(m[0]) != len(m[i]) for i in range(1, len(m))): raise ValueError('irregular matrix') rowMaxs = [sorted(r, reverse=True)[0] for r in m] colMins = [sorted(c)[0] for c in [[m[r][c] for r in r...
class SurrogateModelSimulator(): """ This class may be used as a surrogate for other simulation models. It has a dictionary that represents the current state and a set of :class:`SimulationMetaModels <MetaModelSimulator>` that may mimic the output functions of the original model. :param params: d...
# for @security_policy @playready @security_level SECURITY_LEVEL = (150, 2000, 3000) LEVEL_150 = SECURITY_LEVEL[0] # 'LEVEL_150', LEVEL_2000 = SECURITY_LEVEL[1] # 'LEVEL_2000' LEVEL_3000 = SECURITY_LEVEL[2] # 'LEVEL_3000' def check(playready_security_level) -> bool: return playready_security_level in SECURITY_...
#!/usr/bin/python3 STATE = { 'running' : True, 'paused' : False, 'text' : False, 'explore' : True } TEXT = { 'file' : 'text_settings.txt', 'type' : 'dict', 'data' : { 'int' : { 'type' : 'int', 'data' : { ...
# This sample tests for/else loops for cases where variables # are potentially unbound. # For with no break and no else. def func1(): for x in []: a = 0 # This should generate a "potentially unbound" error. print(a) # This should generate a "potentially unbound" error. print(x) # For w...
class ConstraintError(Exception): pass class ValidationError(Exception): pass
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def search(self, node): if not node: return None if not node.left and not node....
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'WMS Accounting', 'version': '1.1', 'summary': 'Inventory, Logistic, Valuation, Accounting', 'description': """ WMS Accounting module ====================== This module makes the link between th...
EXTRACTORS = { "dlib-hog-face5": {"type": "dlib", "detector": "hog", "keypoints": "face5",}, "dlib-hog-face68": {"type": "dlib", "detector": "hog", "keypoints": "face68",}, "dlib-cnn-face5": {"type": "dlib", "detector": "cnn", "keypoints": "face5",}, "dlib-cnn-face68": {"type": "dlib", "detector": "cnn"...
algorithm='ddpg' env_class='Gym' model_class='LowDim2x' environment = { 'name': 'BipedalWalker-v2' } model = { 'state_size': 24, 'action_size': 4 } agent = { 'action_size': 4, 'evaluation_only': True } train = { 'n_episodes': 10000, 'max_t': 2000, 'solve_score': 300.0 }
# Category description for the widget registry NAME = "Wofry ESRF Extension" DESCRIPTION = "Widgets for Wofry" BACKGROUND = "#ada8a8" ICON = "icons/esrf2.png" PRIORITY = 14
# Enter your code here. Read input from STDIN. Print output to STDOUT def isprime(x): if x == 1: return False elif x == 2: return True else: if x % 2 == 0: return False else: bound = int(x**0.5) for counter in range(3, bound+1, 2): if x % c...
# Let's use christmas date as an example # Who doesn't like christmas? :) # 2021-12-25 YYYY_MM_DD = "%Y-%m-%d" # 25-12-2021 DD_MM_YYYY = "%d-%m-%Y" # 12-25-2021 MM_DD_YYYY = "%m-%d-%Y" # 12-2021 MM_YYYY = "%m-%Y" # 2021-12 YYYY_MM = "%Y-%m" # December 25, 2021 MONTH_SPACE_DD_COMA_SPACE_YYYY = "%B %d, %Y"
NAME = 'drf-querystringfilter' VERSION = __version__ = "2.1.0" __author__ = 'sax'
class OlaMundo(): def __init__(self): self.message = "open source" def print_message(self): print("Olá mundão %s" % self.message) if __name__ == "__main__": olaMundo = OlaMundo() olaMundo.print_message()
# -*- coding: utf-8 -*- # @Author : LG """ 执行用时:36 ms, 在所有 Python3 提交中击败了87.93% 的用户 内存消耗:13.7 MB, 在所有 Python3 提交中击败了55.99% 的用户 解题思路: 动态规划 由于不能挨着偷取,所以 当前偷取的值依赖于上上一个 dp[i] == dp[i-2]+nums[i] 当前偷取的最大值为 dp[i] == max(dp[i-2]+nums[i], dp[i-1]) """ class Solution: def rob(self, nums: List[in...
def main(): while True: num = int(input()) print(num ** 2, flush = True) if num < 0: return if __name__ == '__main__': main()
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
class Motor: def __init__(self, cilindros, tipo='gasolina') -> None: self.cilindros = cilindros self.tipo = tipo self.__temperatura = 0 def inyecta_gasolina(self, cantidad): pass
#encoding:utf-8 subreddit = 'gtaonline' t_channel = '@redditgtaonline' def send_post(submission, r2t): return r2t.send_simple(submission)
filename = 'programming.txt' with open(filename, 'a') as file_object: file_object.write("I also love finding meaning in large datasets.\n") file_object.write("I love creating apps that can run in a browser.\n")
# Marcelo Campos de Medeiros # ADS UNIFIP 2020.1 # 3 Lista # Patos-PB maio/2020 ''' Faça um programa que leia as notas referentes às duas avaliações de um aluno. Calcule e imprima a média semestral. Faça com que o algoritmo só aceite notas válidas (uma nota válida deve pertencer ao intervalo [0,10]). Cada nota deve se...
# You are given a string S. Find the lexicographically smallest string S′ obtained by permuting the characters of S. # Here, for different two strings s=s1​s2​…sn​ and t=t1​t2​…tm​, s<t holds lexicographically when one of the conditions below is satisfied. # There is an integer i (1≤i≤min(n,m)) such that si​<ti​ and sj...
class Model(object): def predict(self, X, feature_names): print(X) return X
def dErrors(X, y, y_hat): DErrorsDx1 = [X[i][0]*(y[i]-y_hat[i]) for i in range(len(y))] DErrorsDx2 = [X[i][1]*(y[i]-y_hat[i]) for i in range(len(y))] DErrorsDb = [y[i]-y_hat[i] for i in range(len(y))] return DErrorsDx1, DErrorsDx2, DErrorsDb def gradientDescentStep(X, y, W, b, learn_rate = 0.01): y...
# Ler nome e preço de vários produtos, perguntar se quer continuar # Mostrar depois: Total gasto na compra, Qts prod custaram mais de 1000 e qual o nome do prod mais barato print('==='*10) print('DELLinux Store'.center(30)) print('==='*10) tot = tot1000 = menor = cont = 0 barato = ' ' while True: nome = str(input('...
""" @Project : DuReader @Module : __init__.py.py @Author : Deco [deco@cubee.com] @Created : 8/13/18 3:43 PM @Desc : """
class Video: def __init__(self, id: str, date: str, title: str): self.id = id self.date = date self.title = title def __members(self): return ( self.id, self.date, self.title, ) def __eq__(self, other) -> bool: if type(oth...
class LogLevels: def __init__(self): self.__Load_Dict() def __Load_Dict(self): lines = [] with open("LogLevels.csv", 'r') as log_level_file: for each_line in log_level_file: each_line = each_line.replace('\n', '') lines.append(each_line) ...
while True: line = input() if line == "Stop": break print(line)
# # Karl Keusgen # 2020-09-23 # UseJsonConfig = False
def green_bold(payload): """ Format payload as green. """ return '\x1b[32;1m{0}\x1b[39;22m'.format(payload) def yellow_bold(payload): """ Format payload as yellow. """ return '\x1b[33;1m{0}\x1b[39;22m'.format(payload) def red_bold(payload): """ Format payload as red. """ ...
class SimpleLinkedListNode: value: None next_node: None def __init__(self, value, next_node = None): self.value = value self.next_node = next_node def set_next_node(self, next_node): self.next_node = next_node def __repr__(self): return f'{self.value}' ...
# Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def sumOfLeftLeaves(self, root: Optional[TreeNode]) -> int: def s(node, isLeft=True): if...
# -*- coding: utf-8 -*- """ The print proxy is a mechanism to provide fully variable pdf print creation process inside of the oereb server with minimal impact on the behavior of it. The idea is to bind an external web accessible print service to the oereb server. The extract is generated by the oereb server the result ...
#Crie um programa que leia duas notas de um aluno calcule sua média, mostrando no final, de acordo #com sua média atingida: #- Média abaixo de 5.0 REPROVADO #- Média entre 5.0 e 6.9 RECUPERAÇÃO #- Média 7.0 ou superior APROVADO n1 = float(input('Digite sua primeira nota!')) n2 = float(input('Digite sua segunda ...
# -*- coding: utf-8 -*- { 'name': 'InfoSaône / Module Odoo de gestion des lots pour le contrôle qualité', 'version': '1.0', 'category': 'InfoSaône', 'description': """ Gestion du contrôle qualité """, 'author': 'Tony GALMICHE / Asma BOUSSELMI', 'maintainer': 'InfoSaone', 'website': 'http://...
def main(): for tc in range(int(input())): N, ans = int(input()), -1 for a in range(1,N//2): b = (N*(2*a-N))//(2*(a-N)) c = N-a-b if a+b+c==N and a*a+b*b==c*c: ans = max(ans,a*b*c) print(ans) if __name__=="__main__": main()
# %% [8. String to Integer (atoi)](https://leetcode.com/problems/string-to-integer-atoi/) class Solution: def myAtoi(self, s: str) -> int: try: s = re.match(r"\+?-?[0-9]+", s.strip()).group() return min(2147483647, max(-2147483648, int(s))) except: return 0
# Succesfull HTTP_200_OK: int = 200 # Client Error HTTP_400_BAD_REQUEST: int = 400 HTTP_401_UNAUTHORIZED: int = 401 HTTP_403_FORBIDDEN: int = 403 HTTP_404_NOT_FOUND: int = 404 HTTP_405_METHOD_NOT_ALLOWED: int = 405 HTTP_409_CONFLICT: int = 409 HTTP_428_PRECONDITION_REQUIRED: int = 428 # Server Error HTTP_500_INTERNAL...
""" R 1.10 --------------------------------- Problem Statement : What parameters should be sent to the range constructor, to produce a range with values 8, 6, 4, 2, 0, −2, −4, −6, −8? Author : Saurabh """ print([x for x in range(8, -10, -2)])
c, link = emk.module("c", "link") link.depdirs += [ "$:proj:$" ]
adjoining = [(1, 0), (-1, 0), (0, 1), (0, -1)] def compute_max_square(tiles): def is_square(x, y, m): for dx in range(m): for dy in range(m): uid = (x + dx, y + dy) if uid not in tiles: return False return True max_square = 0 ...
apis = { 'PhishTank': [ { 'name': 'PT_01', 'url': 'http://checkurl.phishtank.com/checkurl/', 'api_key': '' } ], 'GoogleSafeBrowsing': [ { 'name': 'GSB_01', 'url': 'https://safebrowsing.googleapis.com/v4/threatMatches:find', ...
class WorkflowStatus: ACTIVE = 'ACTIVE' COMPLETED = 'COMPLETED' FAILED = 'FAILED' CANCELED = 'CANCELED' TERMINATED = 'TERMINATED' CONTINUED_AS_NEW = 'CONTINUED_AS_NEW' TIMED_OUT = 'TIMED_OUT' class RegistrationStatus: REGISTERED = 'REGISTERED' DEPRECATED = 'DEPRECATED'
# circular queue (원형 큐) # - 1. 크기가 정해져 있는 배열(list) # - 2. head, tail # - 3 - 1. 비어있는 큐를 어떻게 표현할 것이냐? # - 3 - 2. Out of Index 를 어떻게 할 것이냐? # head와 tail을 같은곳에 둔다 => h와 t가 같으면 empty이다 # --> 큐가 가득 찬것과 비어있는 것을 어떻게 구분할 것이냐? # tail은 값을 넣은 후에 움직인다. -> 마지막 데이터의 다음을 가리키고 있다. # -> t + 1 == h이면 full이다 # ADT -> Abstract Data Type...
class Solution: def myAtoi(self, str): """ :type str: str :rtype: int """ if str == "": return 0 lens = len(str) result = 0 flag = 1 i = 0 while i < lens and str[i] == " ": i += 1 if i < lens and str[i] ...
class Enemy: hp = 200 def __init__(self, attack_low, attack_high): self.attack_high = attack_high self.attack_low = attack_low def getAttackLow(self): print("Low Attack", self.attack_low) return self.attack_low def getAttackHigh(self): print("High Attack", sel...
""" Problem found on Hacker Rank: https://www.hackerrank.com/challenges/drawing-book/problem?utm_campaign=challenge-recommendation&utm_medium=email&utm_source=24-hour-campaign Observations About the Problem: - the last page, and n if n is odd, then that means the last page number is odd. Likewise, it is also prin...