index
int64
repo_name
string
branch_name
string
path
string
content
string
import_graph
string
57,905
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/array/p0051_N-Queens.py
""" 51. N-Queens Hard The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle. Each solution contains a distinct board configuration of the n-queens' placement, where 'Q' and '.' ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,906
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/stack/p0225_Implement_Stack_using_Queues.py
""" 225. Implement Stack using Queues Easy Implement a last in first out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal queue (push, top, pop, and empty). Implement the MyStack class: void push(int x) Pushes element x to the top of the stack. int pop() ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,907
klgentle/lc_python
refs/heads/master
/base_practice/ava.py
number_file = open("numbers.txt", "r") total = 0 count = 0 ave = 0 num = number_file.readline() while num != "": amount = int(num) total += amount count += 1 num = number_file.readline() number_file.close() ave = total / count print(format(ave, ".1f"))
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,908
klgentle/lc_python
refs/heads/master
/stock_pandas/assignment2.py
import requests url = "https://sites.google.com/site/chnyyang/price_data.csv" f = requests.get(url) with open("price_data.csv", "wb") as code: code.write(f.content)
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,909
klgentle/lc_python
refs/heads/master
/leet_code/easy_case/p0020_Valid_Parentheses.py
from typing import List, Any from pysnooper import snoop class Solution: @snoop() def isValid(self, s: str) -> bool: if not s: return True if len(s) % 2 == 1: return False pair_bracket = {"(": ")", "{": "}", "[": "]", ")": "(", "}": "{", "]": "["} brack...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,910
klgentle/lc_python
refs/heads/master
/leet_code/easy_case/generate.py
import pysnooper class Solution: @pysnooper.snoop() def generate(self, numRows: int) -> list: if not numRows: return [] ret = [[1],[1,1]] for j in range(2,numRows): row = [1] last_list = ret[-1] print(f"len(last_list):{len(last_list)}") ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,911
klgentle/lc_python
refs/heads/master
/GUI/my_window.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # author:洪卫 import tkinter as tk # 使用Tkinter前需要先导入 # 第1步,实例化object,建立窗口window window = tk.Tk() # 第2步,给窗口的可视化起名字 window.title("My Window") # 第3步,设定窗口的大小(长 * 宽) window.geometry("600x400") # 这里的乘是小x # 第4步,在图形界面上设定标签 var = tk.StringVar() # 将label标签的内容设置为字符类型,用var来接收hit_...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,912
klgentle/lc_python
refs/heads/master
/base_practice/for_sep.py
for i in range(5): print(i,'hello','kkkl',sep='')
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,913
klgentle/lc_python
refs/heads/master
/base_practice/translator.py
def jiugongge_letter_to_number(phoneNum) -> str: """老手机中的九宫格字母转为对应的数字""" # phoneNum = input("Enter a phone number to be translated: ") # phoneNum = "555-GET-FOOD" phoneNum = phoneNum.upper() phoneNum_list = phoneNum.split("-") # ['555','GET','FOOD'] for j in range(len(phoneNum_list)): ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,914
klgentle/lc_python
refs/heads/master
/stock_pandas/plt_bar.py
import matplotlib.pyplot as plt import pandas as pd # x 是x轴,y是y轴, loan = pd.read_csv("loan.csv") x = [625, 650, 675, 700, 725, 750, 775, 800] y = [2.0, 2.0, 1.0, 3.0, 4.0, 2.0, 1.0, 2.0] p1 = plt.bar(x, height=y, width=25) plt.title("Credit_score") plt.grid(axis='y') plt.grid(axis='x') plt.show()
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,915
klgentle/lc_python
refs/heads/master
/leet_code/medium_case/P0018_4sum.py
""" Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: The solution set must not contain duplicate quadruplets. """ class Solution: def fourSum(self, nu...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,916
klgentle/lc_python
refs/heads/master
/database/batch_replace.py
import os import sys import logging logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") # 绝对路径的import sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../") # from database.FindViewOriginalTable import FindViewOriginalTable # from database.Procedure import Procedure from databas...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,917
klgentle/lc_python
refs/heads/master
/Intermediate_Python/except_e_args.py
try: file = open("text.txt", "rb") except IOError as e: print("An IOError occured. {}".format(e.args[-1]))
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,918
klgentle/lc_python
refs/heads/master
/leet_code/easy_case/maxSubArray.py
class Solution: def maxSubArray(self, nums: list) -> int: max_nums = max(nums) sum_nums = sum(nums) max_sum = max(max_nums, sum_nums) l = len(nums) print(f"max_sum:{max_sum}") if l == 1 or max_sum < 0: return max_sum m,n = 0,l max_list = n...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,919
klgentle/lc_python
refs/heads/master
/database/Procedure.py
import time import sys import os import re import logging # 项目根目录 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # 添加系统环境变量 sys.path.append(BASE_DIR) # 导入模块 from database.convert_file_to_utf8 import convert_file_to_utf8 from string_code.StringFunctions import StringFunctions from decorator_test...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,920
klgentle/lc_python
refs/heads/master
/svn_operate/send_mail_with_attach.py
#!/usr/bin/python3 import traceback import time import os import smtplib from email.mime.text import MIMEText from email.utils import formataddr from email.mime.multipart import MIMEMultipart # from pysnooper import snoop from getpass import getpass from sys import argv sender = "jian.dong2@pactera.com" # 发件人邮箱 #...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,921
klgentle/lc_python
refs/heads/master
/tests/testDealInterval.py
import os import sys from os.path import dirname import datetime import pprint import unittest # 项目根目录 BASE_DIR = dirname(dirname(os.path.abspath(__file__))) # 添加系统环境变量 sys.path.append(BASE_DIR) from automatic_office.DealInterval import DealInterval class testDealInterval(unittest.TestCase): def setUp(self): ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,922
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/P0116_Populating_Next_Right_Pointers_in_Each_Node.py
""" You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition: struct Node { int val; Node *left; Node *right; Node *next; } Populate each next pointer to point to its next right node. If there is no next right n...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,923
klgentle/lc_python
refs/heads/master
/automatic_office/Holiday.py
import json import requests import os from datetime import datetime class Holiday(object): def is_holiday(self, date_str: str) -> bool: """ date_str: YYYYmmdd 周末上班对应结果为 0, 休息日对应结果为 1, 节假日对应的结果为 2 不上班有两种情况: 1: josn data is 1 or 2 2: weekend and josn data not equal t...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,924
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/P0297_Serialize_and_Deserialize_Binary_Tree.py
""" Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment. Design an algorithm to serialize and deserialize ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,925
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/sliding_window/p0239_Sliding_Window_Maximum.py
""" 239. Sliding Window Maximum Hard You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. Return the max sliding window. ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,926
klgentle/lc_python
refs/heads/master
/leet_code/top_interview_questions/Medium_Case/P0179_Largest_Number.py
class Solution: def largestNumber(self, nums: List[int]) -> str: # improve step by step if set(nums) == {0}: return "0" nums_str = [str(i) for i in nums] ret_len = len("".join(nums_str)) nums_str_ind = [[str(i),ind] for ind, i in enumerate(nums)] ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,927
klgentle/lc_python
refs/heads/master
/leet_code/easy_case/plusOne.py
class Solution: def plusOne(self, digits: list) -> list: l = len(digits) if digits[-1] < 9: digits[-1] += 1 elif digits[-1] == 9: digits[-1] = 10 for i in range(-1, -l, -1): # print(i) if digits[i] == 10: ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,928
klgentle/lc_python
refs/heads/master
/database/cx_Oracle_test.py
from data_base_connect import connect #import cx_Oracle # use in linux or centos, not in windos (libclntsh.so: cannot open shared object file: No such file or directory) #conn = cx_Oracle.connect('rptuser', 'rptuser','100.11.94.176:1521/odsdb') conn = connect() cursor = conn.cursor() cursor.execute("select id from rpt...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,929
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/p0099_Recover_Binary_Search_Tree.py
""" 99. Recover Binary Search Tree Hard You are given the root of a binary search tree (BST), where exactly two nodes of the tree were swapped by mistake. Recover the tree without changing its structure. Follow up: A solution using O(n) space is pretty straight forward. Could you devise a constant space solution? ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,930
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/queue/p0232_Implement_Queue_using_Stacks.py
""" 232. Implement Queue using Stacks Easy Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty). Implement the MyQueue class: void push(int x) Pushes element x to the back of the queue. int pop...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,931
klgentle/lc_python
refs/heads/master
/vs_code/split_dept.py
import shutil, os import openpyxl class SplitDept(object): def __init__(self,sheet_name): self.from_path = "/mnt/e/yx_walk/report_develop/report_dept" self.from_file = "ods_reports.xlsx" self.to_file = "ods_reports_out.xlsx" self.data_row = [] self.data_list = [] se...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,932
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/p0889_Construct_Binary_Tree_from_Preorder_and_Postorder_Traversal.py
""" 889. Construct Binary Tree from Preorder and Postorder Traversal Medium Return any binary tree that matches the given preorder and postorder traversals. Values in the traversals pre and post are distinct positive integers. Example 1: Input: pre = [1,2,4,5,3,6,7], post = [4,5,2,6,7,3,1] Output: [1,2,3,4,5,6,7...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,933
klgentle/lc_python
refs/heads/master
/encode/encrypt.py
from Crypto.Cipher import DES key = b'abcdefgh' # 密钥 8位或16位,必须为bytes def pad(text): """ # 加密函数,如果text不是8的倍数【加密文本text必须为8的倍数!】,那就补足为8的倍数 :param text: :return: """ while len(text) % 8 != 0: text += ' ' return text des = DES.new(key, DES.MODE_ECB) # 创建一个DES实例 #text = 'Python ro...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,934
klgentle/lc_python
refs/heads/master
/tests/test_os_sep.py
import os def test_change_path_sep(path): if path.find("\\") > -1 and os.sep != "\\": path = path.replace("\\", os.sep) elif path.find("/") > -1 and os.sep != "/": path = path.replace("/", os.sep) return path if __name__== "__main__": path1 = "1000_编辑区/1300_编码/1301_ODSDB/RPTUSER/05Pr...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,935
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/array/p1011_Capacity_To_Ship_Packages_Within_D_Days.py
""" 1011. Capacity To Ship Packages Within D Days Medium A conveyor belt has packages that must be shipped from one port to another within D days. The ith package on the conveyor belt has a weight of weights[i]. Each day, we load the ship with packages on the conveyor belt (in the order given by weights). We may not ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,936
klgentle/lc_python
refs/heads/master
/tests/unittest_demo.py
import unittest class TestDict(unittest.TestCase): def setUp(self): print('setUp...') def test_some_case(self): pass def tearDown(self): print('tearDown...') if __name__ == '__main__': unittest.main()
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,937
klgentle/lc_python
refs/heads/master
/base_practice/print_prime.py
def main(): for c in range(1,100): if is_prime(c): print(c) def is_prime(v): if v<2: return False elif v==2: return True else: i=2 while i<v: if((v%i)==0): return False else: i+=1 return ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,938
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/P0106_Construct_Binary_Tree_from_Inorder_and_Postorder_Traversal.py
""" Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. For example, given inorder = [9,3,15,20,7] postorder = [9,15,7,20,3] Return the following binary tree: 3 / \ 9 20 / \ 15 7 """ class Solution: de...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,939
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/array/p0710_Random_Pick_with_Blacklist.py
""" 710. Random Pick with Blacklist Hard Given a blacklist B containing unique integers from [0, N), write a function to return a uniform random integer from [0, N) which is NOT in B. Optimize it such that it minimizes the call to system’s Math.random(). Note: 1 <= N <= 1000000000 0 <= B.length < min(100000...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,940
klgentle/lc_python
refs/heads/master
/base_practice/rename_file_to_lower.py
import os # import sh def filename_to_lower(file_dir=os.getcwd()): # can't rename filename to filename.lower with os.rename() for filename in os.listdir(file_dir): if filename.startswith("P_"): old_src = os.path.join(file_dir, filename) tmp_src = os.path.join(file_dir, filenam...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,941
klgentle/lc_python
refs/heads/master
/base_practice/create_foler_and_file_from_list.py
import os from pprint import pprint PATH = "/mnt/d/code_test/lc_python/leet_code/top_interview_questions" # PATH = "D\\code_test\\lc_python\\leet_code\\top_interview_questions" def open_file(file_name: str) -> list: file_name_list = [] with open(file_name, "r") as file: for line in file.readlines(): ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,942
klgentle/lc_python
refs/heads/master
/leet_code/medium_case/0091_Decode_Ways.py
from pysnooper import snoop class Solution: """ s = '226' set[0] = 2 set[1] = [[2,2],[22]] set[2] = [[2,26],[22,6],[2,2,6]] """ @snoop() def numDecodings(self, s: str) -> int: if not s or s.startswith('0'): return 0 dp = [0] * len(s) dp[0] = 1 for i in ra...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,943
klgentle/lc_python
refs/heads/master
/leet_code/easy_case/lengthOfLastWord.py
class Solution: def lengthOfLastWord(self, s: str) -> int: lst = s.strip().split(" ") print(lst) return len(lst[-1]) if bool(lst) else 0 if __name__ == "__main__": a = Solution() a.lengthOfLastWord("a ")
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,944
klgentle/lc_python
refs/heads/master
/tests/test_re_match.py
import unittest import re class TestReMatch(unittest.TestCase): def test_some_case(self): s = """<img ' 'onload="this.parentNode.parentNode.classList.remove(\'placeholder\')" ' 'class="" alt="" ' 'data-src="https://images.weserv.nl/?url=https://i.imgur.com/kewGjoO.jpg#vwid=860&vhei=1290" ' 'src="https://...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,945
klgentle/lc_python
refs/heads/master
/GUI/window_with_input_and_button.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # author:洪卫 import tkinter as tk # 使用Tkinter前需要先导入 # 第1步,实例化object,建立窗口window window = tk.Tk() # 第2步,给窗口的可视化起名字 window.title("My Window") # 第3步,设定窗口的大小(长 * 宽) window.geometry("800x300") # 这里的乘是小x # 第4步,在图形界面上设定输入框控件entry框并放置 lbl = tk.Label(window, text="请输入something"...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,946
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/p0112_Path_Sum.py
""" 112. Path Sum Easy Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum. A leaf is a node with no children. Example 1: Input: root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 2...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,947
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/linked_list/p0382_Linked_List_Random_Node.py
""" 382. Linked List Random Node Medium Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen. Example 1: Input ["Solution", "getRandom", "getRandom", "getRandom", "getRandom", "getRandom"] [[[1, 2, 3]], [], [], [], [], []] Output [...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,948
klgentle/lc_python
refs/heads/master
/automatic_office/ExtractTheReferencedFile.py
import os import shutil import sys import logging import yaml #logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") logging.basicConfig(level=logging.DEBUG, format="%(levelname)s: %(message)s") class ExtractTheReferencedFile(object): def __init__(self, versionDate): self.versionD...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,949
klgentle/lc_python
refs/heads/master
/leet_code/easy_case/rob_ans2.py
# coding:utf8 #import pysnooper class Solution(object): # debug here #@pysnooper.snoop() def rob(self, nums: list) -> int: """ :type nums: List[int] # 这是一个动态规划问题 """ l = len(nums) opt = [0, 0] opt.extend([None] * (l - 2)) if not nums: ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,950
klgentle/lc_python
refs/heads/master
/data_structure/knap_rec.py
""" 背包问题 一个背包,可以装下weight的重量. 现在一个集合S, 里面有多个物品,请写一个程序,判断是否存在若干件个物品,刚好重量为weight -----提示: 考虑最后一件物品 """ def knap_rec(weight, wlist, n): if weight == 0: return True if weight < 0 or (weight > 0 and n < 1): return False # 考虑第n件物品 if knap_rec(weight - wlist[n - 1], wlist, n - 1): pri...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,951
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/linked_list/p0025._Reverse_Nodes_in_k-Group.py
""" 25. Reverse Nodes in k-Group Hard Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then left-out nodes, in the end, should remain as it...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,952
klgentle/lc_python
refs/heads/master
/vs_code/list_file.py
import os import time def list_file(path: str, file_name: str, path2: str): to_file = open(file_name, "w") date_str = time.strftime("%Y%m%d", time.localtime()) to_path = f"D:\jdong\\beta\\{date_str}beta\\{path2}" for f in os.listdir(path): s = f"@@{to_path}\{f};\n" to_file.write(s) ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,953
klgentle/lc_python
refs/heads/master
/base_practice/GolfScoreWriter.py
def main(): """ 代码修改记录: 1、删除count=0, count+=1不需要赋值,count是变量,它的值在range里 2、golf.file改为golf_file 3、删除所有的,sep='', sep在的话,无法input 4、input 修改,不能有多个, 5、wirte修改为write,单词写错 """ num=int(input("Enter number of players:")) golf_file=open('golf.txt','w') for count in range(1,num+1): ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,954
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/p0429_N-ary_Tree_Level_Order_Traversal.py
""" Given an n-ary tree, return the level order traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples). Example 1: Input: root = [1,null,3,2,4,null,5,6] Output: [[1],[3,2,4],[5,6]] """ """ ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,955
klgentle/lc_python
refs/heads/master
/leet_code/medium_case/0238_Product_of_Array_Except_Self.py
class Solution: """ List set value is faster than append value """ def productExceptSelf(self, nums: list) -> list: length = len(nums) left = [1]*length right = [1]*length ret = [1]*length for i in range(1,length): left[i] = left[i-1] * nums[i-1] ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,956
klgentle/lc_python
refs/heads/master
/data_structure/c9_3_bubble_sort.py
def bubble_sort(lst): for i in range(len(lst)): #一次完整的扫描(比较和交换)能保证把一个最大的元素移到到未排序部分的最后 for j in range(1, len(lst) - i): if lst[j - 1].key > lst[j].key: lst[j - 1], lst[j] = lst[j], lst[j - 1] def bubble_sort2(lst): """改进:如果在一次扫描中没有遇到逆序,说明排序工作已经完成,可以提前结束了""" for i...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,957
klgentle/lc_python
refs/heads/master
/leet_code/medium_case/0287_Find_the_Duplicate_Number.py
class Solution(object): """refer to http://bookshadow.com/weblog/2015/09/28/leetcode-find-duplicate-number/""" def findDuplicate(self, nums): # The "tortoise and hare" step. We start at the end of the array and try # to find an intersection point in the cycle. slow = 0 fast = 0...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,958
klgentle/lc_python
refs/heads/master
/automatic_office/CreateWeekReport.py
import datetime import pysnooper import pprint import os import sys import shutil import docx import logging import openpyxl # 绝对路径的import sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../") logging.basicConfig(level=logging.DEBUG, format="%(levelname)s: %(message)s") from automatic_office.CheckInFo...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,959
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/p0700_Search_in_a_Binary_Search_Tree.py
""" 700. Search in a Binary Search Tree You are given the root of a binary search tree (BST) and an integer val. Find the node in the BST that the node's value equals val and return the subtree rooted with that node. If such a node does not exist, return null. Example 1: Input: root = [4,2,7,1,3], val = 2 Output...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,960
klgentle/lc_python
refs/heads/master
/leet_code/medium_case/findNumberOfLIS_673_v1.py
#! python3 from collections import Counter from pprint import pprint class Solution: def findNumberOfLIS(self, nums) -> int: # def findNumberOfLIS(self, nums: List[int]) -> int: # 给定一个未排序的整数数组,找到最长递增子序列的个数。 """ to looking for increase sub set, conside each point of the list, ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,961
klgentle/lc_python
refs/heads/master
/base_practice/ph.py
print(f"please input ph value:") ph=float(input()) print(f"input:{ph}") if ph<7.0: neutral=0;base=0;acid=1 elif ph>7.0: neutral=0;base=1;acid=0 elif ph==7.0: neutral=1;base=0;acid=0 print(f"neutral={neutral};base={base};acid={acid}")
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,962
klgentle/lc_python
refs/heads/master
/leet_code/easy_case/numberOfBoomerangs_ref.py
class Solution: """ 执行用时: 1624 ms, 在Number of Boomerangs的Python3提交中击败了79.56% 的用户 """ def numberOfBoomerangs(self, points): """ 降维 看似三个点之间比较,其实只要比两个点 计算其他点到当前点的距离,如果相同距离的点有2个以上则满足(有An2种可能) :type points: List[List[int]] :rtype: int """ n = l...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,963
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/p0662_Maximum_Width_of_Binary_Tree.py
""" 662. Maximum Width of Binary Tree Medium Given a binary tree, write a function to get the maximum width of the given tree. The maximum width of a tree is the maximum width among all levels. The width of one level is defined as the length between the end-nodes (the leftmost and right most non-null nodes in the lev...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,964
klgentle/lc_python
refs/heads/master
/leet_code/medium_case/p0535_Encode_and_Decode_TinyURL.py
class Codec: def __init__(self): self.hashDict = {} self.tinyPrefix = 'http://tinyurl.com/' def encode(self, longUrl: str) -> str: """Use hash method to encodes a URL to a shortened URL. """ shortUrl = self.tinyPrefix + str(hash(longUrl)) self.hashDict[shortUrl] ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,965
klgentle/lc_python
refs/heads/master
/wechat/tm_01_birthday.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/9/26 14:29 # @Author : T.M. # @File : tm_01_定时发送生日祝福.py # @Software: PyCharm """ 1.扫描学生信息表,根据当天日期,找到当天过生日同学的姓名(微信昵称) 2.登录微信接口,发送消息 """ import time import pandas as pd from wxpy import * def get_birthday_student_list(): # 1.读取学生信息表 df = p...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,966
klgentle/lc_python
refs/heads/master
/tests/test_raise_error.py
inputValue=input("please input a int data :") if inputValue != '1': raise ValueError("not 1") #raise Exception("not 1") else: print(inputValue)
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,967
klgentle/lc_python
refs/heads/master
/leet_code/easy_case/isValid_answer.py
class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ if len(s) % 2 != 0: return False lb = {"(": ")", "[": "]", "{": "}"} queue = [] for x in s: if x in lb: queue.append(x) ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,968
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/linked_list/p0092_Reverse_Linked_List_II.py
""" 92. Reverse Linked List II Medium Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: Input: 1->2->3->4->5->NULL, m = 2, n = 4 Output: 1->4->3->2->5->NULL """ # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,969
klgentle/lc_python
refs/heads/master
/database/AutoViewReplace.py
import os import sys import logging import re logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") # 绝对路径的import sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../") from database.Procedure import Procedure from database.FindViewOriginalTable import FindViewOriginalTable clas...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,970
klgentle/lc_python
refs/heads/master
/scrapy_test/scrapy_test.py
import requests def requests_auth_login(): s = requests.Session() r = s.get("http://100.11.94.171:8080/BOE/CMC", auth=("administrator", "Yxjk123")) print(r.status_code) print(r.text) # print(r.url) # print(r.cookies) r2 = s.get("http://100.11.94.171:8080/BOE/CMC/1901061353/admin/logon.face...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,971
klgentle/lc_python
refs/heads/master
/leet_code/medium_case/stoneGame.py
from functools import lru_cache class Solution: def stoneGame(self, piles): N = len(piles) @lru_cache(None) def dp(i, j): # The value of the game [piles[i], piles[i+1], ..., piles[j]]. if i > j: return 0 parity = (j - i - N) % 2 if parity == ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,972
klgentle/lc_python
refs/heads/master
/stock_pandas/Advanced2.py
Date=input("Enter a date between 8/8/2018 and 8/7/2019: ") share1=int(input("Enter the number of shares of IBM:\n")) share2=int(input("Enter the number of shares of MSFT:\n")) #Date_str='3/29/2019' #share1=4666 #share2=3222 date_list = Date_str.split('/') Date = date_list[-1]+'/'+date_list[0]+'/' +date_list[1] #print(...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,973
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/p0110_Balanced_Binary_Tree.py
""" 110. Balanced Binary Tree Easy Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in which the left and right subtrees of every node differ in height by no more than 1. Example 1: Input: root = [3,9,20,null,null,15,7] Out...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,974
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/array/p0316_Remove_Duplicate_Letters.py
""" 316. Remove Duplicate Letters Medium Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible results. Note: This question is the same as 1081: https://leetcode.com/problems/smallest-subse...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,975
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/dynamic_programming/p0494_Target_Sum.py
""" 494. Target Sum Medium You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as its new symbol. Find out how many ways to assign symbols to make sum of integers equal to target S. Example 1: Input: nu...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,976
klgentle/lc_python
refs/heads/master
/stock_pandas/ConvertibleBondAnalysis.py
""" 1.分析可转债近一年收益情况,如果按海哥的策略(现价/转股价>= 96%),一年单账户可以获利多少 2.需要准备多少资金, 3.如果修改策略单账户最多获利多少, 4.一个人最多可以申请几个账户 5.理论上一个人动用多个账户一年最多可以赚多少? """ import pandas as pd import pandas_datareader.data as web import time class ConvertibleBondAnalysis(object): def __init__(self): self._bond_data = pd.read_csv("convertibile_bond...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,977
klgentle/lc_python
refs/heads/master
/tests/test_subprogress.py
import subprocess import os os.chdir("/mnt/d/code_test/game_test/nsf") subprocess.Popen( [ "curl", "https://qpix.com/images/2020/03/27/svpd.jpg", "-o", "0_svpd.jpg", "--silent", ] )
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,978
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/linked_list/p0206_Reverse_Linked_List.py
""" 206. Reverse Linked List Easy Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? """ # Definition for singly-linked list. # class ListNode: # def __init__(self,...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,979
klgentle/lc_python
refs/heads/master
/cs61a/codetest_test.py
def print_factors(n): """Print the prime factors of N. >>> print_factors(180) 2 2 3 5 """ pass if __name__ == "__main__": import doctest doctest.testmod()
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,980
klgentle/lc_python
refs/heads/master
/base_practice/tea.py
resugar=1.5 rebutter=1 reflour=2.75 recookies=48 num_cookies=int(input("Enter number of cookies:")) sugar_needed=(resugar/48)*num_cookies butter_needed=(rebutter/48)*num_cookies flour_needed=(reflour/48)*num_cookies print("You need",format(sugar_needed,'.2f'),"cups of sugar,",format(butter_needed,'.2f'),"cups of butter...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,981
klgentle/lc_python
refs/heads/master
/leet_code/medium_case/wordBreak.py
class Solution: """ # 139 Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. """ def wordBreak(self, s, wordDict:list)->bool: if not s: return ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,982
klgentle/lc_python
refs/heads/master
/automatic_office/decryptZipFile_v2.py
import os # import py7zr from itertools import product import subprocess filepath = r"D:\code_test\game_test\confidential_data" namepath = r"D:\code_test\game_test\confidential_data\pvideo.7z" def verify_password(pwd): cmd = f'7z t -p{pwd} {namepath}' #print(f"test cmd: {cmd}") status = subprocess.call(c...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,983
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/p0104_Maximum_Depth_of_Binary_Tree.py
""" 104. Maximum Depth of Binary Tree Easy Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Example 1: Input: root = [3,9,20,null,null,15,7] Output: 3 Example 2: Input: root ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,984
klgentle/lc_python
refs/heads/master
/automatic_office/DealInterval.py
import datetime #import pysnooper #import pprint import os import sys # 绝对路径的import sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../") """ 根据工作日期,生成周报模板 """ class DealInterval(object): def __init__(self): pass @staticmethod def get_from_end_str(date_tuple: tuple) -> str: ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,985
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/sliding_window/1004._Max_Consecutive_Ones_III.py
""" 1004. Max Consecutive Ones III Medium Given an array A of 0s and 1s, we may change up to K values from 0 to 1. Return the length of the longest (contiguous) subarray that contains only 1s. Example 1: Input: A = [1,1,1,0,0,0,1,1,1,1,0], K = 2 Output: 6 Explanation: [1,1,1,0,0,1,1,1,1,1,1] Bolded numbers wer...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,986
klgentle/lc_python
refs/heads/master
/stock_pandas/stock_anal.py
""" fix records: 1. end date is 2019/8/16 2. add while, date input format 3. pd.contact -> pd.concat([df1, df2]) """ import pandas as pd from_date = "2018/1/17" to_date = "2019/8/16" # for test start = "2018-03-20" start = input("Enter the beginning date between 2018-1-17 and 2019-8-16: ") start_list = start.split("...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,987
klgentle/lc_python
refs/heads/master
/automatic_office/CheckInForm.py
import datetime import logging import os import re import sys import time import platform logging.basicConfig(level=logging.DEBUG, format="%(levelname)s: %(message)s") # 绝对路径的import sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../") from automatic_office.Holiday import Holiday from docx import Docum...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,988
klgentle/lc_python
refs/heads/master
/base_practice/assets.py
def main(): """ num -> nums, 变量区分开来,不要混用了 ave should not in cycle """ nums=int(input("Enter the number of assets:")) portfolio=0.00 try: record_file=open('record.txt','w') for num in range(1,nums+1): print("****** For asset",num,"******") name=str(inpu...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,989
klgentle/lc_python
refs/heads/master
/plt/bar_test.py
from matplotlib import pyplot as plt num_list = [6,4,2,0,3,2,0,3,1,4,5,3,2,7,5,3,0,1,2,1,3,4,6,8,1,3] length = range(len(num_list)) plt.bar(length,num_list) plt.show()
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,990
klgentle/lc_python
refs/heads/master
/code_in_books/lp3thw/ex13_argv.py
from sys import argv script, first, second, third = argv print("Script is: ", script) print(f"Your first variable is: {first}" ) print(f"Your second variable is: {second}" ) print(f"Your third variable is: {third}" )
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,991
klgentle/lc_python
refs/heads/master
/scrapy_test/ScrapyBoForUpdate.py
""" TODO 写一个爬虫,从服务器取最新Bo,然后保存到本地 """ class ScrapyBoForUpdate(object): def __init__(self): self.bo_url = r"http://100.11.94.171:8080/BOE/BI" def login(self): pass
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,992
klgentle/lc_python
refs/heads/master
/data_structure/SStack.py
class StackUnderflow(ValueError): pass class SStack(): def __init__(self): self._elems = [] def is_empty(self): return self._elems == [] def top(self): if self._elems == []: raise StackUnderflow("In SStack.top()") return self._elems[-1] def push(self, ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,993
klgentle/lc_python
refs/heads/master
/vs_code/envelopes.py
def compare(a,b): if a[0] == b[0]: return b[1] - a[1] return a[0] - b[0] # 列表 envelopes = [[5,4],[6,4],[6,7],[2,3]] # 指定第二个元素排序 envelopes.sort(key=compare) print(envelopes)
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,994
klgentle/lc_python
refs/heads/master
/leet_code/medium_case/0394_decode_string.py
class Solution: def decodeString(self, s: str) -> str: stack = [] curString = "" curNum = 0 for c in s: if c.isdigit(): curNum = curNum * 10 + int(c) elif c == "[": stack.append(curString) stack.append(curNum) ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,995
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/p0230_Kth_Smallest_Element_in_a_BST.py
""" Given the root of a binary search tree, and an integer k, return the kth (1-indexed) smallest element in the tree. Example 1: Input: root = [3,1,4,null,2], k = 1 Output: 1 """ class Solution: def __init__(self): self.treeList = [] def kthSmallest(self, root: TreeNode, k: int) -> int: ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,996
klgentle/lc_python
refs/heads/master
/stock_pandas/plt_bar3.py
import matplotlib.pyplot as plt import pandas as pd # x 是x轴,y是height, loan = pd.read_csv("loan.csv") # 单列时sort不用写by x = loan["Credit_score"].drop_duplicates().sort_values() #print(x) y = loan["Credit_score"].groupby(loan["Credit_score"]).count() #print(y) #x = [625, 650, 675, 700, 725, 750, 775, 800] #y = [2.0, 2.0, ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,997
klgentle/lc_python
refs/heads/master
/leet_code/easy_case/minCostClimbingStairs.py
class Solution: # leetcode 746. 使用最小花费爬楼梯 def minCostClimbingStairs(self, cost: List[int]) -> int: cost.append(0) # add zero to jump to top c = [] c.append(cost[0]) # c[0], c[1] c.append(cost[1]) l = len(cost) for i in range(2,l): c.append(min(c[i-2] +...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,998
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/dynamic_programming/p0416_Partition_Equal_Subset_Sum.py
""" Given a non-empty array nums containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Example 1: Input: nums = [1,5,11,5] Output: true Explanation: The array can be partitioned as [1, 5, 5] and [11]. Example 2: Input: num...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
57,999
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/p0113_Path_Sum_II.py
""" 113. Path Sum II Medium Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where each path's sum equals targetSum. A leaf is a node with no children. Example 1: Input: root = [5,4,8,11,null,13,4,7,2,null,null,5,1], targetSum = 22 Output: [[5,4,11,2],[5,8,4,5]] Example 2:...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
58,000
klgentle/lc_python
refs/heads/master
/leet_code/easy_case/isHappy.py
class Solution: def isHappy(self, n: int) -> bool: m = 0 return False if self.squareSum(n,m) != 1 else True def squareSum(self, n: int, m:int) -> int: m += 1 s = str(n) sum = 0 if m > 9: return -1 if len(s) > 1: for i in s:...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
58,001
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/sliding_window/p0567_Permutation_in_String.py
""" 567. Permutation in String Medium Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutations is the substring of the second string. Example 1: Input: s1 = "ab" s2 = "eidbaooo" Output: True Explanation: s2 contains one ...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
58,002
klgentle/lc_python
refs/heads/master
/leet_code/easy_case/missingNumber.py
class Solution: def missingNumber(self, nums: list) -> int: l = len(nums) lst = [i for i in range(0,l+1)] for i in set(lst) - set(nums): return i if __name__ == '__main__': a = Solution() #a.missingNumber([3,0,1]) a.missingNumber([0])
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
58,003
klgentle/lc_python
refs/heads/master
/leet_code/top_interview_questions/Medium_Case/P0227_Basic_Calculator_II_complex.py
class Solution: def calculate(self, s: str) -> int: if s == '0': return 0 s2 = s.replace(" ",'') if s2.isnumeric(): return int(s2) out = 0 length = len(s2) num_list = [] method_list = [] a = s2[0] # put all number and me...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...
58,004
klgentle/lc_python
refs/heads/master
/leet_code/labuladong/tree/p0101_Symmetric_Tree_2.py
""" 101. Symmetric Tree Easy Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But the following [1,2,2,null,3,null,3] is not: 1 / \ 2 2 \ \ 3 3 Fo...
{"/tests/testCreateWeekReport.py": ["/automatic_office/CreateWeekReport.py"], "/tests/re_test.py": ["/database/Procedure.py"], "/tests/test_procedure.py": ["/database/Procedure.py"], "/tests/test_proc_log_modify.py": ["/database/ProcedureLogModify.py"], "/database/batch_replace.py": ["/database/ProcedureLogModify.py", ...