content
stringlengths
7
1.05M
expected_output = { "version": { "version_short": "03.04", "platform": "Catalyst 4500 L3 Switch", "version": "03.04.06.SG", "image_id": "cat4500e-UNIVERSALK9-M", "os": "IOS-XE", "image_type": "production image", "compiled_date": "Mon 04-May-15 02:44", ...
class Executions(object): def __init__(self): self.executions = [] def append(self, execution): self.executions.append(execution) def shares_traded(self): return sum([abs(item.qty) for item in self.executions]) def __len__(self): return len(self.executions)
#entrada a, b, c = str(input()).split() a = float(a) b = float(b) c = float(c) #processamento/saída if (a + b) > c and (a + c) > b and (c + b) > a: perimetro = a + b + c print("Perimetro = {:.1f}".format(perimetro)) else: area = ((a + b) * c) / 2 print("Area = {:.1f}".format(area))
# Copyright (c) 2018, Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
# Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. Enter 7...
def bogota_to_mio(bogota_id): lookup = { 0: 0, # ... background 1: 1, # articulated-truck - articulated-truck 2: 2, # bicycle 3: 3, # bus 4: 4, # car 5: 5, # motorcycle 6: 4, # suv-car 7: 4, # taxi-car 8: 8, # person/pedest...
"""Constants for Traccar integration.""" CONF_MAX_ACCURACY = "max_accuracy" CONF_SKIP_ACCURACY_ON = "skip_accuracy_filter_on" ATTR_ADDRESS = "address" ATTR_CATEGORY = "category" ATTR_GEOFENCE = "geofence" ATTR_MOTION = "motion" ATTR_SPEED = "speed" ATTR_TRACKER = "tracker" ATTR_TRACCAR_ID = "traccar_id" ATTR_STATUS =...
# Input: x = 123 # Output: 321 # Input: x = -123 # Output: -321 class Solution: def reverse(self, x: int) -> int: string = str(abs(x)) reversed = int(string[::-1]) if reversed > 2147483647: return 0 elif x > 0: return reversed return -1 * reversed...
primes = [] def is_prime(number): for i in primes: if number % i == 0: return False return True def get_prime(target): i = 1 while(len(primes)< target): i += 1 if is_prime(i): primes.append(i) return primes[-1] print(get_prime(10001))
load(":utils.bzl", "CONDA_EXT_MAP", "EXECUTE_TIMEOUT", "INSTALLER_SCRIPT_EXT_MAP", "execute_waitable_windows", "get_arch", "get_os", "windowsify") # CONDA CONFIGURATION CONDA_MAJOR = "3" CONDA_MINOR = "py39_4.10.3" CONDA_SHA = { "Windows": { "x86_64": "b33797064593ab2229a0135dc69001bea05cb56a20c2f243b12312...
num=int(input("Enter a number to be reversed: ")) print("The number in reversed order is: ") for i in range(len(str(num))): m=num%10 print(m,end='') num//=10
# # @lc app=leetcode id=320 lang=python3 # # [320] Generalized Abbreviation # # @lc code=start class Solution: def generateAbbreviations(self, word: str): if not word: return [""] ans = [''] for i in range(len(word)): temp = [] for item in ans: ...
class Tile: def __init__(self, x, y, tile_type): self.x = x self.y = y self.tile_type = tile_type
""" defines a command extension system that is used by billy-util new commands can be added by deriving from BaseCommand and overriding a few attributes: name: name of subcommand help: help string displayed for subcommand add_args(): method that calls `self.add_argument` han...
# Define the rotors # Each value represents the amount that must be added # to get the output value when feeding input into that index. # Index values must be adjusted to account for rotation. rotors = [[1, 2, 4, 7, 1, 9, 2, 0, 1, 3], [0, 2, 3, 9, 2, 4, 5, 7, 0, 8], [5, 8, 9, 4, 9, 3, 4, 5, 6, 7], ...
class stack(object): def __init__(self): self.stk = [] #initializing an array as a stack def is_empty(self): return self.stk == [] def push(self, item): self.stk.append(data) def pop(self): if self.is_empty(): print("the stack is empty") ...
n=int(input()) coin=[] for i in range(n): a,b=map(int,input().split()) coin.append([min(a,b),max(a,b)]) print(len(list(map(list,set(map(tuple,coin))))))
class Node(): def __init__(self, val, children: list['Node'] = []) -> None: self.val = val self.children = children # 1 # / \ # 2 3 # / \ / \ # 4 5 6 7 four = Node(4) five = Node(5) six = Node(6) seven = Node(7) two = Node(2, [four, five])...
""" The :mod:`websockets.extensions.base` defines abstract classes for extensions. See https://tools.ietf.org/html/rfc6455#section-9. """ class ClientExtensionFactory: """ Abstract class for client-side extension factories. Extension factories handle configuration and negotiation. """ name = ....
# -*- coding: utf-8 -*- description = 'sps devices' group = 'lowlevel' tangohost = 'phys.spheres.frm2' profibus_base = 'tango://%s:10000/spheres/profibus/sps_' % tangohost profinet_base = 'tango://%s:10000/spheres/profinet/back_' % tangohost analogs = dict( rpower = dict(desc='reactor power', unit='MW', low=Fal...
# -*- coding: utf-8 -*- sn = 's' numLis = [] while sn != 'n': num = int(input('Digite um número: ')) numLis.append(num) sn = str(input('Quer continuar? [S/N]: ').strip() ).lower() while sn != 's' and sn != 'n': print('Opção inválida.') sn = str(input('Quer continuar? [S/N]: ').stri...
def to_camel_case(snake_str: str) -> str: """ Convert a snake_case string to camelCase. :param snake_str: The input in snake_case :return: The input, but in camelCase """ components = snake_str.split('_') # We capitalize the first letter of each component except the first one # with the...
""" Sistema de perguntas e respostas """ print() print('Desafio multipla escolha.') print('=' * 28) pergutas = { 'Pergunta 1': { 'pergunta': 'Quanto é 2 + 2? ', 'respostas': {'a': '1', 'b': '4', 'c': '5'}, 'respostas_certas': 'b', }, 'Pergunta 2': { 'pergunta': 'Quanto é 3 *...
""" This package contains the cryptography backends. ========== Submodules ========== * :py:mod:`.dummy`: Fast but insecure key generation (pk == sk == address) and encryption (enc = (+), dec = (-)) for debugging * :py:mod:`.rsa_pkcs15`: Slow, secure rsa key generation and encryption using RSA PKCS1.5 padding * :py:mo...
# This is the solution for Sorting > NumberOfDiscIntersections # # This is marked as RESPECTABLE difficulty class Disc(): def __init__(self, low_x, high_x): self.low_x = low_x self.high_x = high_x def index_less_than(sortedDiscList, i, start, last): mid = start + (last - start) // 2 if las...
class FileFormatError(Exception): """ raised on errors parsing various files """ pass class UnknownFileExtension(Exception): def __init__(self, file_extension): self.file_extension = file_extension class FileNotFound(Exception): def __init__(self, filename): self.filename = f...
def main(): print(summation(100)-multiplication(100)) def summation(n): res = 0 for i in range(1, n+1): res += i return res*res def multiplication(n): res = 0 for i in range(1, n+1): res += i * i return res
N = int(input()) towers = 0 last = 0 sequence = [int(x) for x in input().split()] for x in sequence: if (x > last): towers += 1 last = x print(towers)
# Available constants: # They are to assign a type to a field with a value null. # NULL_BOOLEAN, NULL_CHAR, NULL_BYTE, NULL_SHORT, NULL_INTEGER, NULL_LONG # NULL_FLOATNULL_DOUBLE, NULL_DATE, NULL_DATETIME, NULL_TIME, NULL_DECIMAL # NULL_BYTE_ARRAY, NULL_STRING, NULL_LIST, NULL_MAP # # Available Objects: # # ...
# LCM 33 class Solution: def search(self, nums: List[int], target: int) -> int: n = len(nums) if n == 0: return -1 if n == 1: return 0 if nums[0] == target else -1 # apply modified binary search low = 0 high = n-1 while low <= high: ...
# -*- coding: utf-8 -*- __name__ = 'google_streetview' __author__ = 'Richard Wen' __email__ = 'rrwen.dev@gmail.com' __version__ = '1.2.9' __license__ = 'MIT' __description__ = 'A command line tool and module for Google Street View Image API.' __long_description_content_type__='text/markdown' __keywords__ = [ ...
def print_sequence(n): for i in range(1, n+1): print(i, end="") if __name__ == '__main__': n = int(input("Enter number :")) print_sequence(n)
class Hello(object): @staticmethod def hello_w() -> str: return f"hello"
class NodoCola: def __init__(self): self.__numero = 0 self.__siguiente = None def getNumero(self): return self.__numero def setNumero(self, numero): self.__numero = numero def getSiguiente(self): return self.__siguiente def setSiguiente(self, siguiente): ...
# Copyright (c) 2016 Cloudbase Solutions Srl # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
node = S(input, "application/json") oldValue = node.prop("order") jsonObject = { "name": "test", "comment": "42!" } node.prop("order", jsonObject) newValue = node.prop("order")
class Button: def __init__(self, fn): self.fn = fn def click(self): self.fn() def test(string): print(string) fn = lambda: test('Pesho') button_1 = Button(fn) button_1.click() button_1.click() button_2 = Button(lambda: test('Toto')) button_2.click()
# Contributed by @Hinal-Srivastava #Get Inputs from User def get_input(): a = int(input("Enter 1st number: ")) b = int(input("Enter 2nd number: ")) return a, b #Error Message for IndexOutOfBoundException def error(): print("Invalid Entry") #Addition def add(): x, y = get_input() return x + y ...
""" Demonstrates iterating/looping through a list """ #A list named temperatures temperatures = [34.56, 56.45, 45.98, 47.62, 67.87, 55.12] #Prints every value in the temperatures list using a for loop for t in temperatures : print(t) #********************************# print() """ #Prints every value in the temper...
# -*- coding: utf-8 -*- n = int(input()) for _ in range(n): A, B = input().split() if A[len(A)-len(B):] == B: print('encaixa') else: print('nao encaixa')
class TemplateFileType: def __init__(self): pass StandardPage = 0 WikiPage = 1 FormPage = 2
# /usr/bin/env/ python3 """ custom exception handling """ class PreconditionError(Exception): """ an exception for detecting precondition error """ def capture_exception(e: Exception) -> None: """ global way of capturing an exception :param e: :return: """ print(str(e)) def capt...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Advent of Code 2018, Day 00 - Part 0 # https://github.com/vesche # def main(): with open("day00_input.txt") as f: data = f.read() if __name__ == "__main__": main()
#!/usr/local/bin/python # Code Fights Range Bit Count (Core) Problem def rangeBitCount(a, b): return (''.join([bin(n) for n in range(a, b + 1)])).count('1') def main(): tests = [ [2, 7, 11], [0, 1, 1], [1, 10, 17], [8, 9, 3], [9, 10, 4] ] for t in tests: ...
# # Approach 3: Divide and Conquer # class Solution(object): # def searchMatrix(self, matrix, target): # """ # :type matrix: List[List[int]] # :type target: int # :rtype: bool # """ # if not matrix: # return False # return self.searchRect(0, 0, len...
# -*- coding: utf-8 -*- # Copyright 2019 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
""" Increment Decrement. Writing "a += 1" is equivalent to "a = a + 1". Writing "a -= 1" is equivalent to "a = a - 1". """ a = 0 b = 0 direction = True def setup(): size(640, 360) colorMode(RGB, width) b = width frameRate(30) def draw(): a += 1 if a > width: a = 0 direction ...
# Time: O(n) | Space: O(d) is depth def productSum(array, multiplier = 1): sum = 0 for element in array: if type(element) is list: sum += productSum(element, multiplier + 1) else: sum += element return sum * multiplier
input() string = input() result = string[0] lastChar = string[0] for i in range(len(string)): if string[i] != lastChar: result += string[i] lastChar = string[i] print(len(string) - len(result))
garbled = "IXXX aXXmX aXXXnXoXXXXXtXhXeXXXXrX sXXXXeXcXXXrXeXt mXXeXsXXXsXaXXXXXXgXeX!XX" message = filter(lambda letter: letter.replace("X", ""), garbled) print(message)
N = int(input('Digite um numero:')) a = N - 1 s = N + 1 #print('analisando o valor {} , seu antecessor e {} e o sucessor e {} '.format(N, a, s)) print(f'Analisando o valor {N} , seu antecessor e {a} e o sucessor e {s}')
__version__ = '0.0.8' __title__ = 'repovisor' __summary__ = 'A tool for managing many repositories and creating daily reports' __uri__ = 'https://github.com/gjcooper/repovisor' __license__ = 'BSD' __author__ = 'Gavin Cooper' __email__ = 'gjcooper@gmail.com'
# This is the main code for the problem! Driver code should be same as present on HackerRank! def isPalindrome(s): for idx in range(len(s)//2): if s[idx] != s[len(s)-idx-1]: return False return True def palindromeIndex(s): for idx in range((len(s)+1)//2): if s[idx] != s[len(s)...
# 引导程序(启动程序服务地址) 9092 是kafka默认端口号 # BOOTSTRAP_SERVERS = "ip:port" BOOTSTRAP_SERVERS = "127.0.0.1:9092"
name = 'rextest' version = '1.3' def commands(): env.REXTEST_ROOT = '{root}' env.REXTEST_VERSION = this.version env.REXTEST_MAJOR_VERSION = this.version.major # prepend to non-existent var env.REXTEST_DIRS.prepend('{root}/data') alias('rextest', 'foobar') # Copyright 2013-2016 Allan Johns. # ...
# site_no -- Site identification number # station_nm -- Site name # site_tp_cd -- Site type # lat_va -- DMS latitude # long_va -- DMS longitude # dec_lat_va -- Decimal latitude # dec_long_va -- Decimal longitude # coord_meth_cd -- Latitude-longitude method # coord_...
# /* # * Copyright (C) 2019 Atos Spain SA. All rights reserved. # * # * This file is part of pCEP. # * # * pCEP is free software: you can redistribute it and/or modify it under the # * terms of the Apache License, Version 2.0 (the License); # * # * http://www.apache.org/licenses/LICENSE-2.0 # * # * The softw...
a = 1 done = False list = [3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19] while not done: if a % 10 == 0: for i in list: if a % i == 0: if i == 19: done = True print(a) else: break a += 1
# Copyright 2016 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
__author__ = 'ThanhNam' # Enter your code for the Adopter class here class Adopter:#(object): """ Adopters represent people interested in adopting a species. They have a desired species type that they want, and their score is simply the number of species that the shelter has of that species. """ ...
free = True node_id = '762' node_password = '656531' local_path = '' code_done = False
class BfsSearchNode: def __init__(self, position, moves, parent = None, warpHistory = None): self.parent = parent self.position = position self.moves = moves self.warpHistory = warpHistory or [] def getMinimumSteps(maze, multilevel = False): startingPoint, endingPoint, warpPoint...
""" Parser for MCNP in-files""" EN_DELTA = 0.001 class Surface: def __init__(self, num, geom_type, geom_params): self.num = num self.type = geom_type self.geom_params = geom_params def __repr__(self): s = "%i %s " % (self.num, self.type) s += " ".join...
print('Welcome to the Average Calculator App.') # get user input name = input('\nWhat is your name? : ').title().strip() count = int(input('How many grades would you like to enter? : ')) # get user's grades grades = [] for i in range(1, count + 1): grades.append(int(input('Enter grade : '))) # sort grades and pri...
class Solution: def findWords(self, words: List[str]) -> List[str]: """Hash set. """ rows = [set(['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p']), set(['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l']), set(['z', 'x', 'c', 'v', 'b', 'n', 'm'])] res = []...
pqrsf=( (("Petición"),("Petición")), (("Queja"),("Queja")), (("Reclamo"),("Reclamo")), (("Solicitud"),("Solicitud")), (("Felicitación"),("Felicitación")) )
lf=[] for i in range(2): l=[int(i) for i in input().strip().split()] lf.append(l) print(lf) for i in lf: print(i)
class Item(): def __init__(self,value): self.value = value self.nxt = None self.prev = None def get_nxt(self): return self.nxt def get_prev(self): return self.prev def get_val(self): return self.value def set_nxt(self,nxt_): self.nxt = nxt_ def set_prev(self,prev_): self.prev = pre...
color_list = ["Red", "Green", "White", "Black"] print("%s %s" % (color_list[0], color_list[-1])) """ Write a Python program to display the first and last colors from the following list. Go to the editor color_list = ["Red","Green","White" ,"Black"] """
class Base: WINDOW_W = 700 WINDOW_H = 550 GAME_WH = 500 SIZE = 5 FPS = 60 DEBUG = False COLORS = { '0': (205, 193, 180), '2': (238, 228, 218), '4': (237, 224, 200), '8': (242, 177, 121), '16': (245, 149, 99), '32': (246, 124, 95), '64'...
""" A module showing off the second while-loop pattern. Here we are using a while-loop that stops when a goal in the specification is true. Author: Walker M. White Date: April 15, 2019 """ def prompt(prompt,valid): """ Returns: the choice from a given prompt. This function asks the user a questio...
#Análisis de Algoritmos 3CV2 # Alan Romero Lucero # Josué David Hernández Ramírez # Práctica 1 Algoritmo de Euclides # Generador Fibonacci. def fibonacci ( ): a, b = 1, 1 while ( True ): #yield:Se usa para retornar "generators", objetos iteradores que se comportan de manera muy similar a una lista. ...
def is_alt(s): return helper(s, 0, 1) if s[0] in "aeiou" else helper(s, 1, 0) def helper(s, n, m): for i in range(n, len(s), 2): if s[i] not in "aeiou": return False for i in range(m, len(s), 2): if s[i] in "aeiou": return False return True
"""定期PING送信のLambdaプログラムです """ def lambda_handler(event, context): """Lambdaハンドラのメインプログラムです """
"""Palette of colors collected from Mondrian's paintings""" mondrian_palette = { "red2": { "rgb": [ 221, 40, 32 ], "hex": "#dd2820" }, "yellow": { "rgb": [ 252, 218, 77 ], "hex": "#fcda4d...
print('___') answers = [] for i in range(2, 10000000): s = 0 for k in str(i): s += int(k) ** 5 if i == s: answers.append(i) print(answers, sum(answers))
input = """ % test skip of Propagate_DeriveSingleUndefinedPosBodyLiteral() a :- b. b :- a. a | b. -a :- not a. -b :- not b. """ output = """ % test skip of Propagate_DeriveSingleUndefinedPosBodyLiteral() a :- b. b :- a. a | b. -a :- not a. -b :- not b. """
class StackTrace(object): """ Represents a stack trace,which is an ordered collection of one or more stack frames. StackTrace() StackTrace(fNeedFileInfo: bool) StackTrace(skipFrames: int) StackTrace(skipFrames: int,fNeedFileInfo: bool) StackTrace(e: Exception) StackTrace(e: Exception,fN...
# your credentials.py should look as follows USER_TOKEN = 'your facebook user token' email_address = 'email address to send out menus' email_password = 'email password' admin_email = 'admin email to sent error messages' slack_webhook = 'slack webhook to post to slack'
nome = input('Digite o seu nome: ') print(nome.upper()) print(nome.lower()) nome = nome.split() primeironome = nome[0] nome = ''.join(nome) print('Seu nome tem {} letras'.format(len(nome))) print('O seu primeiro nome ({}) tem {} letras'.format(primeironome, len(primeironome)))
"""Hyper parameters.""" __author__ = 'Erdene-Ochir Tuguldur' class HParams: """Hyper parameters""" disable_progress_bar = False # set True if you don't want the progress bar in the console logdir = "logdir" # log dir where the checkpoints and tensorboard files are saved data_path = '/media/DATA/SW...
""" [04/16/13] Week-Long Challenge #1: Make a (tiny) video game! https://www.reddit.com/r/dailyprogrammer/comments/1ch463/041613_weeklong_challenge_1_make_a_tiny_video_game/ # [](#EasyIcon) *(Easy)*: Make a tiny video game! **Please note this is an official week-long challenge; all submissions are due by Monday night...
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A, B, K): # write your code in Python 3.6 if K == 0: print('terrible mistake, someone is trying to divide by 0') return 0 result = 0 biggyfound = smallyfound = False upperbonus = ...
# # PySNMP MIB module TPT-HIGH-AVAIL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPT-HIGH-AVAIL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:18:53 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
""" Auteur: Frédéric Castel Date : Avril 2020 Projet : MOOC Python 3 - France Université Numérique Objectif: Écrire une fonction check_sudoku capable de vérifier si la grille passée en paramètre, sous forme d’une matrice 9 x 9 d’entiers, est une solution au problème du sudoku. La fonction retournera la rép...
primeiro = int(input('Primeiro termo:')) razao = int(input('Razão da PA:')) termo = primeiro #neste caso esta dizendo que a var vai começar com... cont = 1 #a contagem vai começar em 1 total = 0 mais = 10 while mais != 0: total += mais while cont <= total: print('{} → '. format(termo), end='') ...
class Silly: def __setattr__(self, attr, value): if attr == "silly" and value == 7: raise AttributeError("you shall not set 7 for silly") super().__setattr__(attr, value) def __getattribute__(self, attr): if attr == "silly": return "Just Try and Change Me!" ...
def leiaint(msg): while True: try: n = int(input(msg)) except (ValueError, TypeError): print('\033[31mERRO: Por favor, digite um numero inteiro valido.\033[m ') continue except (KeyboardInterrupt): print('\033[31mUsuario preferiu nao digitar es...
#!/bin/python3 def n2l(n): return chr((n%26)+65) def l2n(l): return (ord(l.upper())-65) % 26 def l2n2ls(l,s=0): if l.isalpha(): if l.isupper(): return n2l(l2n(l) + s) else: return (n2l(l2n(l) + s)).lower() else: return l if __name__ == '__main__': ...
class CustomException(Exception): def __init__(self, *args, **kwargs): return super().__init__(self, *args, **kwargs) def __str__(self): return str(self.args [1]) class DeprecatedException(CustomException): def __init__(self, *args, **kwargs): return super().__init__(*args, **kwargs)...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
class nBitArray() : m = 32 f = 'I' _default_type = None def __init__(self, n_bit) : if not (isinstance(n_bit, int) and n_bit > 0) : raise ValueError self.n_bit = n_bit self.n_item = 0 self.b_mask = (2 ** self.n_bit) - 1 self.i_mask = ((0x1 << self.m) - 1) def _normalize_index(self, i...
# # @lc app=leetcode.cn id=39 lang=python3 # # [39] 组合总和 # # https://leetcode-cn.com/problems/combination-sum/description/ # # algorithms # Medium (62.40%) # Total Accepted: 12.8K # Total Submissions: 20.3K # Testcase Example: '[2,3,6,7]\n7' # # 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target...
class Matcher: def __init__(self, routes): self._routes = routes def match_request(self, request): for route in self._routes: match_dict = {} rest = request.path value = True for typ, data in route.segments: if typ == 'exact': ...
# Specs SPECS_STORAGE_PATH = 'specs/' SPECS_FILE_NAME = 'specs.txt' PHONE_LIST = 'phone_list.txt' GSM_ARENA_BASE_URL = "https://www.gsmarena.com/" # Reviews REVIEW_STORAGE_PATH = 'reviews/' REVIEWS_FILE_NAME = 'reviews.txt' AMAZON_BASE_URL = 'https://www.amazon.com/' AMAZON_REVIEW_URL_1 = '/ref=cm_cr_arp_d_paging_btm?i...
{ "targets": [ { "target_name": "roaring", "default_configuration": "Release", "cflags_cc": ["-O3", "-std=c++14"], "sources": [ "src/cpp/v8utils/v8utils.cpp", "src/cpp/RoaringBitmap32.cpp" ], "conditions"...
# -*- coding: utf-8 -*- class SourceWrapper(object): """ 数据源包装器,使相关数据源支持逐步读取操作 """ def __init__(self, pcontract, data, max_length): self.data = data self.curbar = -1 self.pcontract = pcontract self._max_length = max_length def __len__(self): return self._max_length...
# based on: https://github.com/tigertv/secretpy/blob/master/secretpy/ciphers/columnar_transposition.py class cipher_columnar_transposition: def __dec(self, alphabet, key, text): chars = [alphabets.get_index_in_alphabet(char, alphabet) for char in key] keyorder = sorted(enumerate(ch...
class AssignParametersMixin: """ Adds the functionality to generate the code for passing the parameters in the following form: parameterName={{parameterName}} """ def generate_parameters_code(self): return super().generate_parameters_code() + \ [parameter.name + "={{" + param...
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'includes': [ '../../build/common.gypi', '../../build/version.gypi', ], 'targets': [ { ...