blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
b2c3fd6bce8e99cdad91ce11ff361fe7739ce8e5
neginkheirmand/DataStructureAndAlgorithms
/HW2/NotStackIsPOSHTE.py
1,680
3.828125
4
poshte=[] #O(1) def pushToPoshte(number): poshte.append(number) #O(1) def pop(): if len(poshte)==0: return poshte.pop() #O(1) def printPoshte(): for i in range(0, len(poshte)): print(poshte[len(poshte)-1-i], end=' ') print() #O(1) def getMiddle(...
2c4517057bc34e9d45a7695ec3b01a3620483f76
Neelmaurya/Assignment
/LinePlot.py
380
4.21875
4
""" Create Simple line plot, Where x and y axis range from 0-10. This is "Y vs X", x-axis label is "x-axis" and "y-axis" level is "y-axis". """ import numpy as np from matplotlib import pyplot as plt x = np.arange(0, 10, 1) print(x) y = np.arange(0, 10, 1) print(y) plt.xlabel("X-axis") plt.ylabel("Y-axis") plt.title("...
7aff99c4c0ef6ae986e47024449649e7b10edc35
Neelmaurya/Assignment
/Python Practice Prog/Encapsulation.py
342
4.0625
4
# Encapsulation in python class Encap(): def __init__(self): self.name = "Sunil Kumar Maurya" self.__age = "25" def Student(self): return self.name + self.__age ob = Encap() print(ob.name) # This showing error due to Encapsulation print(ob.__age) # For calling this encapsulated item outside the class. #print(ob...
a966c29dfef7e91ea8ff2acb6b41db151e8472ba
Neelmaurya/Assignment
/Prog4.py
345
4.21875
4
""" Write a program that asks the user for a number n and gives them the possibility to choose between computing the sum and computing the product of 1,โ€ฆ,n. """ num = int(input("Enter the Number:- ")) sum = 0 sum1 = 1 for i in range(1, num + 1): sum = sum + i sum1 = sum1 * i print("\n") ...
66e5cf5960d5dd8e2bb7d5cf320186c3dd8d2f77
Neelmaurya/Assignment
/StringLength.py
149
3.78125
4
# Write a program in python find length of Sting without using len() function. a = "I'am Sunil Kumar Maurya" count = 0 for i in a: count = count + 1 print(count)
408354aedeb78bc79b545915cd5429b6221584c2
SdNssr/pyhdl
/pyhdl/simulator.py
1,020
3.671875
4
""" A simulator for composite gates. You can supply an arbitrarily nested list of gates, sorted in topological order. """ def flatten_list(l): """ Flatten an arbitrarily nested list. """ out = [] for x in l: if isinstance(x, (list, tuple)): out.extend(flatten_list(...
2b992bbe20a88aa552752d42ed741d9759210d4f
s4git21/Competitive-Coding-5
/Problem-1.py
1,444
3.765625
4
""" Approach: 1) BFS 2) DFS for both TC: O(n) SC: O(n) """ from collections import deque # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: # Approach : BFS ...
df2f3c3f69bf62b7176d9f9e3c6951dfa2207f64
ncdingari/WebAppEx
/bokeh/bokeh_clustering.py
2,369
3.609375
4
''' Use the ``bokeh serve`` command to run the example by executing: bokeh serve bokeh_hist.py at your command prompt. Then navigate to the URL http://localhost:5006/bokeh_clustering in your browser. ''' import numpy as np from sklearn.cluster import KMeans from sklearn import datasets from bokeh.io impor...
04a2be37eff8e5ff82e4ebd22ba018ef7010f69a
dubugun/big_data_web
/python/0131/16์ง„์ˆ˜ํ•œ๊ธ€์ž.py
410
3.671875
4
sel = input("16์ง„์ˆ˜ ํ•œ๊ธ€์ž๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”") if ord(sel) >= ord('a') and ord(sel) <= ord('f'): print("10์ง„์ˆ˜๋กœ",int(sel,16),"์ž…๋‹ˆ๋‹ค") elif ord(sel) >= ord('A') and ord(sel) <= ord('F'): print("10์ง„์ˆ˜๋กœ",int(sel,16),"์ž…๋‹ˆ๋‹ค") elif ord(sel) >= ord('0') and ord(sel) <= ord('9'): print("10์ง„์ˆ˜๋กœ",int(sel,16),"์ž…๋‹ˆ๋‹ค") else : print("1...
e5878df85cdc75540c657079b34892173821c71e
dubugun/big_data_web
/python/0201/์—ฐ์Šต9.py
326
3.734375
4
a = input('์€ํ–‰์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š” : ') b = input('ํ†ต์žฅ์ด๋‚˜ ์นด๋“œ๋ฅผ ์„ ํƒํ•ด์ฃผ์„ธ์š” : ') c = input('์ž…๊ธˆ์ˆ˜๋‹จ์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š” : ') if (a == 'ํŒŒ์ด') and ((b == 'card') or (b == 'bankbook')) and c == 'money': print('์ž…๊ธˆ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค') else : print('์ž…๊ธˆ์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.')
056f8aa1b0733c04540e72d40dae33ece39f4126
dubugun/big_data_web
/python/0130/์ •๊ทœ์ง์ „ํ™˜.py
159
3.578125
4
score = int(input("์‹œํ—˜์ ์ˆ˜๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”")) if score >= 85: print("์ •๊ทœ์ง ์ „ํ™˜ ๊ฐ€๋Šฅ") else : print("์ •๊ทœ์ง ์ „ํ™˜ ๋ถˆ๊ฐ€๋Šฅ")
e016c41f0003edfa7c8f43afbcead82cf375ea62
dubugun/big_data_web
/python/0202/์ˆซ์ž๋งž์ถ”๊ธฐ๋†€์ด.py
811
3.75
4
import random computer_number = random.randint(1,100) def is_same(target, number) : if target == number : result = 'Win' elif target > number : result = 'Low' else : result = 'High' return result print('์•ˆ๋…• \n ๋‚œ 1๋ถ€ํ„ฐ 100 ์ค‘ ์ˆซ์ž ํ•˜๋‚˜๋ฅผ ๊ณจ๋ž์–ด์š”.') guess = int(input('๋ญ”์ง€ ์“ฐ๊ณ  ์—”ํ„ฐํ‚ค๋ฅผ ๋ˆ„๋ฅด์„ธ์š”.')) ...
4b14e17dbc877e12f36e0d56d770b904999a7d9d
dubugun/big_data_web
/python/0201/0201_์‹ค์Šต_5.py
169
3.796875
4
i, hap = 0,0 num2 = 0 num2 = int(input('๋๊ฐ’ ์ž…๋ ฅ : ')) for i in range(1, num2+1, 1) : if i%3 != 0 : print(i," ") else : print('์ง ')
f55a764fbab0f87b8fa35b665d24149cd3860750
dubugun/big_data_web
/python/0207/0207_4_TV.py
204
3.765625
4
def vol() : vol = 3 print('ํ˜„์žฌ ์Œ๋Ÿ‰์€ 3์ž…๋‹ˆ๋‹ค.') num = int(input('์ฆ๊ฐ€์‹œํ‚ฌ ๋งŒํผ์˜ ์Œ๋Ÿ‰์„ ์ž…๋ ฅ: ')) vol += num print('์ฆ๊ฐ€ ํ›„์˜ ์Œ๋Ÿ‰์€ %d ์ž…๋‹ˆ๋‹ค.' % vol)
736c5795edba857085e26fce3e4497de4bbcbee0
dubugun/big_data_web
/python/0202/ํ•จ์ˆ˜์˜๊ฐœ๋….py
548
3.90625
4
coffee = 0 coffee = int(input('์–ด๋–ค ์ปคํ”ผ ๋“œ๋ฆด๊นŒ์š” ? (1:๋ณดํ†ต, 2:์„คํƒ•, 3:๋ธ”๋ž™) ')) print() print('# 1. ๋œจ๊ฑฐ์šด ๋ฌผ์„ ์ค€๋น„ํ•œ๋‹ค.') print('# 2. ์ข…์ด์ปต์„ ์ค€๋น„ํ•œ๋‹ค.') if coffee == 1 : print('# 3. ๋ณดํ†ต์ปคํ”ผ๋ฅผ ํƒ„๋‹ค') elif coffee == 2: print('# 3. ์„คํƒ•์ปคํ”ผ๋ฅผ ํƒ„๋‹ค') elif coffee == 2: print('# 3. ๋ธ”๋ž™์ปคํ”ผ๋ฅผ ํƒ„๋‹ค') else : print('# 3. ๋ณดํ†ต์ปคํ”ผ๋ฅผ ํƒ„๋‹ค') print('# 4. ๋ฌผ์„ ๋ถ“๋Š”๋‹ค') ...
cd512ea75cb33dee847723370012e650601cb866
dubugun/big_data_web
/python/0202/์‹ค์Šต1.py
122
3.9375
4
n = int(input('enter the number :' )) step = 0 Sum = 0 while step <= n : Sum = Sum + step step += 1 print(Sum)
1af90ade66fd6b360467b68dfb09c1572748d72c
dubugun/big_data_web
/python/0205/0205_1_๊ณผ์ผ.py
1,320
3.546875
4
F = {'์‚ฌ๊ณผ' : 1000,'ํฌ๋„' : 3000,'๋ฐฐ' : 2000,'๊ทค' : 500} str1 = '' total = 0 totalnum = '' while True : str1 = input('๊ตฌ์ž…ํ•˜๋ ค๋Š” ๊ณผ์ผ์˜ ์ด๋ฆ„์„ ์ž…๋ ฅํ•˜์„ธ์š”. (์ž…๋ ฅ์„ ์ข…๋ฃŒํ•˜๋ ค๋ฉด q๋ฅผ ์ž…๋ ฅ)') if str1 == 'q' : break else : num = int(input('๊ตฌ์ž…ํ•˜๋ ค๋Š” ๊ณผ์ผ์˜ ๊ฐœ์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”.')) if str1 == 'ํฌ๋„' : total += nu...
e6214537df2be1d5f3fc6fb9cf726236b7e84c40
dubugun/big_data_web
/python/0130/๋ฒ„์Šคํƒ‘์Šน.py
158
3.53125
4
money = int(input("์นด๋“œ์˜ ์ž”์•ก์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”")) if money > 1200: print("๋ฒ„์Šค ํƒ‘์Šน ๊ฐ€๋Šฅ") else : print("๋ฒ„์Šค ํƒ‘์Šน ๋ถˆ๊ฐ€๋Šฅ")
bf505acc9dffb3559f4870f2db995e23cd906c28
chimuichimu/Codility
/05_PrefixSums/MinAvgTwoSlice/MinAvgTwoSlice_01.py
1,280
3.65625
4
# Score60% ใƒญใ‚ธใƒƒใ‚ฏใƒŸใ‚น # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): # nๅ€‹ใฎ้›†ๅˆ๏ผˆn>3๏ผ‰ใซๅฏพใ—ใฆใ€ใ“ใฎ้›†ๅˆใŒๆœ€ๅฐใฎๅนณๅ‡ๅ€คใ‚’ๆŒใคใจไปฎๅฎšใ™ใ‚‹ใ€‚ # ใ“ใฎใจใ้›†ๅˆใ‚’๏ผ’ใคใฎใƒ–ใƒญใƒƒใ‚ฏใซๅˆ†ใ‘ใ‚‹ใจใ€ใใ‚Œใžใ‚Œใฎใƒ–ใƒญใƒƒใ‚ฏใฎๅนณๅ‡ๅ€คใฏใ€ # ๅ…ƒใฎ้›†ๅˆใจๅŒใ˜ๅนณๅ‡ๅ€คใ‚’ใจใ‚‹ใ‹ใ€ๅ…ƒใฎ้›†ๅˆใ‚ˆใ‚Šๅคงใใ„ๅ€คใจๅฐใ•ใ„ๅ€คใ‚’ใจใ‚‹ใ€‚ # ใ“ใ‚Œใฏใ€Œๆœ€ๅฐใฎๅนณๅ‡ๅ€คใ‚’ๆŒใคใ€ใจใ„ใ†ไปฎๅฎšใซๅใ™ใ‚‹ใ€‚ # ไปฅไธŠใ‹ใ‚‰ๆœ€ๅฐใฎๅนณๅ‡ๅ€คใ‚’ๆŒใคใƒ–ใƒญใƒƒใ‚ฏใฎ่ฆ็ด ๆ•ฐใฏใ€...
db7b29d03b3db6ebdcb40d0f820e0a18b5b9394c
chimuichimu/Codility
/10_Prime and composite numbers/MinPerimeterRectangle.py
426
3.59375
4
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(N): min_perimeter = 100000000000 for i in range(1, int(N**0.5)+1): if N % i == 0: a = i if i != N // i: b = N // i else: ...
350f9e1cbb4e74d66748be10fbeb8a9a4e5d22ff
kalikhademi/Graduate-projects
/Machine Learning in Privacy (Special Topics)/assignments/hw2/hw2/nets.py
3,712
4
4
# -*- coding: utf-8 -*- """ CIS6930PML -- Homework 2 -- nets.py # This file contains the neural network architectures """ import os import sys import numpy as np import keras import tensorflow as tf import matplotlib.pyplot as plt """ ## Simple fully-connected classifier for MNIST """ def get_simple_classifier(fl...
cc53a925d316436408805b68d832e56898331126
kalikhademi/Graduate-projects
/Fundamentals of ML/Projects/Project 00/test.py
1,752
3.53125
4
import matplotlib.pyplot as plt import numpy as np from sklearn.neighbors import KNeighborsClassifier from sklearn.model_selection import train_test_split from sklearn.cluster import KMeans from scipy import stats from random import randint from sklearn.metrics import accuracy_score """================================...
477e25c0a6a5e9795b2061c7fac32dcd15dfa99c
Gijoe614/Madlibs_remade
/mad_libs revised.py
1,112
3.78125
4
# Variables person = raw_input("please enter a persons name:") pet = raw_input("a type of pet:") color = raw_input("a color:") example = raw_input("example of that color:") place = raw_input("a place:") group = raw_input("a group:") person2 = raw_input("another person:") adverb = raw_input("an adverb:") action = raw_in...
8cf82c8ad68685927cf248bbaccaa032278ec6c5
avinash201199/Python-Projects
/image_to_pdf.py
716
3.984375
4
# Python3 program to convert image to pfd # using img2pdf library #first install img2pdf library by running this code on terminal pip install img2pdf # importing necessary libraries import img2pdf from PIL import Image import os # storing image path img_path = "image.jpg" # storing pdf path pdf_path ...
2723d03a17957be36c92fffa1382711008e44ea0
Lucasm4469/cti110
/P4T2_Lucas.py
285
4.21875
4
# Bug Accumulation. total = 0 # Get the bugs collected for each day. for day in range(1, 8): print('Enter the bugs collected on the day', day) bugs = int(input()) total = total + bugs # Display the total bugs. print('You collected a total of', total, 'bugs.')
840a19a97ae76cd3e6b0decb35bc2e563af6cd04
bassref/Spatial-DS-Edwards
/Program_3_Starter/EarthQuakeExample/main.py
1,848
3.765625
4
import pygame import sys,os import json def clean_area(screen,origin,width,height,color): """ Prints a color rectangle (typically white) to "erase" an area on the screen. Could be used to erase a small area, or the entire screen. """ ox,oy = origin points = [(ox,oy),(ox+width,oy),(ox+width,oy+h...
d9e42b9fdd08207de64ecbde3b087da5bf133064
bassref/Spatial-DS-Edwards
/Assignments/Program_5/query3.py
7,323
3.84375
4
""" Rephael Edwards Query 3 This program executes a query to find the top 3-5 clusters of volcanos and earthquakes. The user enters the feature (volcanos or earthquakes), min # of points for a cluster , distance parameter for the db scan Sample Queries: 1) volcanos 10 50 2) earthquakes 20 100 """ import...
ef8d548e20f6988de734d4d2ef30021b2762c1bd
sunsetca/size_checker
/send_twitter.py
896
3.53125
4
''' checkout http://nodotcom.org/python-twitter-tutorial.html for more instructions ''' import tweepy def get_api(cfg): auth = tweepy.OAuthHandler(cfg['consumer_key'], cfg['consumer_secret']) auth.set_access_token(cfg['access_token'], cfg['access_token_secret']) return tweepy.API(auth) def send_simple_twitter()...
067c04b5aaa91d27e9fa3058cb1c7b2b905ef000
Sandeep-Ravula/My_Python_Projects
/Password_generator_GUI_tkinter.py
1,854
3.546875
4
# GUI program to generate the OTP password of given length from tkinter import * import random, re, datetime root = Tk() root.title("Einsttein'S password generator") root.geometry("500x500") root.config(bg = "powderblue") heading = Label(root, text="Password Generator :", font = ("None 28 bold underline"), bg ...
2deb9a5e43fce3c217dc4cce1abadbe5ab6149ea
cyb3rD/LearnPy
/PSet2Task1.py
878
3.8125
4
balance = 4213 annualInterestRate = 0.2 monthlyPaymentRate = 0.04 monthlyInterestRate = annualInterestRate /12.0 month = 1 totalPaid = 0.0 while month <= 12: previousBalance = balance minimumMonthlyPaymentRate = monthlyPaymentRate * previousBalance totalPaid += minimumMonthlyPaymentRate ...
ba53b51ba2282964e3155c8515d7f36ac2c63c0f
cyb3rD/LearnPy
/L3Problem9.py
829
4.03125
4
print 'Please think of a number between 0 and 100!' start = 0 stop = 100 guess = (start+stop)/2 help = 'Enter \'h\' to indicate the guess is too high. Enter \'l\' to indicate the guess is too low. Enter \'c\' to indicate I guessed correctly.' sorry = 'Sorry, I did not understand your input.' strAnswer = 'Game over. Yo...
b1e0e2d9cc7fb68dbceb7856e2be0472a982d3db
saiharsh976/set7sai
/62.py
82
3.515625
4
sa=input() san=set(sa) if(san=={"0","1"}): print("yes") else: print("no")
4797af0ee198f6ef682a60a1147b1852045cb44a
robograder/robogen
/api/words/wordimport.py
5,880
3.828125
4
import sqlite3 import sys import csv import itertools from collections import namedtuple import re conn = sqlite3.connect('db/words.db') c = conn.cursor() # constants VERB = 'verb' NOUN = 'noun' ADJ = 'adjective' ADV = 'adverb' CONNECTIVE = 'connective' JUDGPOS = 1 JUDGNEG = -1 JUDGNONE = 0 # column name normalizat...
e0bc85cbc73ccdd9640212f257ff4be68f436bc9
Iverance/leetcode
/062.unique-paths.py
1,289
3.84375
4
# # [62] Unique Paths # # https://leetcode.com/problems/unique-paths # # Medium (41.37%) # Total Accepted: # Total Submissions: # Testcase Example: '1\n2' # # A robot is located at the top-left corner of a m x n grid (marked 'Start' in # the diagram below). # # The robot can only move either down or...
717276f61718cb3c1d4a5719f49596a15cd41358
Iverance/leetcode
/307.range-sum-query-mutable.py
1,966
3.578125
4
# # [307] Range Sum Query - Mutable # # https://leetcode.com/problems/range-sum-query-mutable # # Medium (20.82%) # Total Accepted: # Total Submissions: # Testcase Example: '["NumArray","sumRange","update","sumRange"]\n[[[1,3,5]],[0,2],[1,2],[0,2]]' # # Given an integer array nums, find the sum of the e...
735f91b04ad11217e7cfa35445122752e8041869
Iverance/leetcode
/417.pacific-atlantic-water-flow.py
2,505
4.0625
4
# # [417] Pacific Atlantic Water Flow # # https://leetcode.com/problems/pacific-atlantic-water-flow # # algorithms # Medium (33.98%) # Total Accepted: 19.5K # Total Submissions: 57.3K # Testcase Example: '[[1,2,2,3,5],[3,2,3,4,4],[2,4,5,3,1],[6,7,1,4,5],[5,1,1,2,4]]' # # Given an m x n matrix of non-negative intege...
472a2a8b429916fb995c7c7d4ef45656f6222a99
Iverance/leetcode
/647.palindromic-substrings.py
1,438
3.9375
4
# # [647] Palindromic Substrings # # https://leetcode.com/problems/palindromic-substrings # # Medium (55.31%) # Total Accepted: # Total Submissions: # Testcase Example: '"abc"' # # # Given a string, your task is to count how many palindromic substrings in this # string. # # # # The substrings ...
5c3a8cbad3bb0fd0d3d3af44ea8752781f330d3d
Iverance/leetcode
/392.is-subsequence.py
1,902
3.921875
4
# # [392] Is Subsequence # # https://leetcode.com/problems/is-subsequence # # algorithms # Medium (44.62%) # Total Accepted: 43.4K # Total Submissions: 97.4K # Testcase Example: '"abc"\n"ahbgdc"' # # # Given a string s and a string t, check if s is subsequence of t. # # # # You may assume that there is only low...
4202d561dbec45547e323d07f85a058c01858cc3
Iverance/leetcode
/217.contains-duplicate.py
757
3.703125
4
# # [217] Contains Duplicate # # https://leetcode.com/problems/contains-duplicate # # Easy (45.70%) # Total Accepted: # Total Submissions: # Testcase Example: '[]' # # # Given an array of integers, find if the array contains any duplicates. Your # function should return true if any value appears at l...
0a4379158b6ea5388edbe7060c7384dd0ab74955
Iverance/leetcode
/487.max-consecutive-ones-ii.py
1,486
3.59375
4
# # [487] Max Consecutive Ones II # # https://leetcode.com/problems/max-consecutive-ones-ii # # algorithms # Medium (45.74%) # Total Accepted: 9.4K # Total Submissions: 20.5K # Testcase Example: '[1,0,1,1,0,1]' # # # Given a binary array, find the maximum number of consecutive 1s in this array # if you can flip at...
8047b37a5c1ff14e7d4077de6c9e4f79639d89da
Iverance/leetcode
/567.permutation-in-string.py
1,458
3.65625
4
# # [567] Permutation in String # # https://leetcode.com/problems/permutation-in-string # # Medium (36.63%) # Total Accepted: # Total Submissions: # Testcase Example: '"ab"\n"eidbaooo"' # # Given two strings s1 and s2, write a function to return true if s2 contains # the permutation of s1. In other wor...
73bce251021ab72f9c6343efbe50c3e164cb33a3
Iverance/leetcode
/086.partition-list.py
1,310
3.8125
4
# # [86] Partition List # # https://leetcode.com/problems/partition-list # # Medium (32.64%) # Total Accepted: # Total Submissions: # Testcase Example: '[]\n0' # # Given a linked list and a value x, partition it such that all nodes less than # x come before nodes greater than or equal to x. # # # ...
bbbd8f9ca5f20802f78c027522c97e313b57eff1
Iverance/leetcode
/067.add-binary.py
958
3.6875
4
# # [67] Add Binary # # https://leetcode.com/problems/add-binary # # Easy (32.66%) # Total Accepted: # Total Submissions: # Testcase Example: '"0"\n"0"' # # # Given two binary strings, return their sum (also a binary string). # # # # For example, # a = "11" # b = "1" # Return "100". # # ...
162f84b720138b7c8537c636eb59aa13b752d7be
Iverance/leetcode
/154.find-minimum-in-rotated-sorted-array-ii.py
1,513
3.5625
4
# # [154] Find Minimum in Rotated Sorted Array II # # https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii # # Hard (37.05%) # Total Accepted: # Total Submissions: # Testcase Example: '[1]' # # # Follow up for "Find Minimum in Rotated Sorted Array": # What if duplicates are allowed? ...
901fa110f60056dff646803dedab6643af28bbfc
Iverance/leetcode
/447.number-of-boomerangs.py
1,456
3.703125
4
# # [447] Number of Boomerangs # # https://leetcode.com/problems/number-of-boomerangs # # algorithms # Easy (45.77%) # Total Accepted: 29.9K # Total Submissions: 65.3K # Testcase Example: '[[0,0],[1,0],[2,0]]' # # Given n points in the plane that are all pairwise distinct, a "boomerang" is # a tuple of points (i, j...
7413a1595904fdbeeb728d263ed84263f5696e9a
Iverance/leetcode
/165.compare-version-numbers.py
2,156
3.796875
4
# # [165] Compare Version Numbers # # https://leetcode.com/problems/compare-version-numbers # # Medium (20.03%) # Total Accepted: # Total Submissions: # Testcase Example: '"1"\n"0"' # # Compare two version numbers version1 and version2. # If version1 > version2 return 1, if version1 < version2 return -...
b14ae63f658118b1f5d2b4a236e3399442cf7481
Iverance/leetcode
/022.generate-parentheses.py
1,081
3.609375
4
# # [22] Generate Parentheses # # https://leetcode.com/problems/generate-parentheses # # Medium (44.57%) # Total Accepted: # Total Submissions: # Testcase Example: '3' # # # Given n pairs of parentheses, write a function to generate all combinations # of well-formed parentheses. # # # # For ex...
02ab582a7b38faa1088d5ef20a5f1d18354bd855
Iverance/leetcode
/259.3sum-smaller.py
1,086
3.5625
4
# # [259] 3Sum Smaller # # https://leetcode.com/problems/3sum-smaller # # algorithms # Medium (41.76%) # Total Accepted: 31.4K # Total Submissions: 75.2K # Testcase Example: '[]\n0' # # Given an array of n integers nums and a target, find the number of index # triplets i, j, k with 0 <= i < j < k < n that satisfy t...
d85516d4ba096d42f025f84bf5a5b90a5ba73204
Iverance/leetcode
/719.find-k-th-smallest-pair-distance.py
1,574
3.9375
4
# # [719] Find K-th Smallest Pair Distance # # https://leetcode.com/problems/find-k-th-smallest-pair-distance # # algorithms # Hard (25.00%) # Total Accepted: 2.8K # Total Submissions: 11.1K # Testcase Example: '[1,3,1]\n1' # # Given an integer array, return the k-th smallest distance among all the # pairs. The dis...
48fbea2a11a317dbf00d483816a7951ec667a078
Iverance/leetcode
/336.palindrome-pairs-1.py
2,638
3.953125
4
# # [336] Palindrome Pairs # # https://leetcode.com/problems/palindrome-pairs # # algorithms # Hard (26.59%) # Total Accepted: 31.7K # Total Submissions: 119.1K # Testcase Example: '["abcd","dcba","lls","s","sssll"]' # # # โ  Given a list of unique words, find all pairs of distinct indices (i, j) # in the given l...
925e7cbd508e264249163bb45b20b09ef00470a8
Iverance/leetcode
/685.redundant-connection-ii.py
3,099
3.734375
4
# # [685] Redundant Connection II # # https://leetcode.com/problems/redundant-connection-ii # # algorithms # Hard (28.53%) # Total Accepted: 2.5K # Total Submissions: 8.8K # Testcase Example: '[[1,2],[1,3],[2,3]]' # # # In this problem, a rooted tree is a directed graph such that, there is # exactly one node (the ...
1149912bf2d65089477d27a10ace7995a7d86892
Iverance/leetcode
/315.count-of-smaller-numbers-after-self.py
2,050
3.71875
4
# # [315] Count of Smaller Numbers After Self # # https://leetcode.com/problems/count-of-smaller-numbers-after-self # # Hard (34.54%) # Total Accepted: # Total Submissions: # Testcase Example: '[5,2,6,1]' # # # You are given an integer array nums and you have to return a new counts # array. # The co...
467f5f980133353526ef147589a07df6d070dbd2
Iverance/leetcode
/044.wildcard-matching.py
2,201
3.921875
4
# # [44] Wildcard Matching # # https://leetcode.com/problems/wildcard-matching # # Hard (20.02%) # Total Accepted: # Total Submissions: # Testcase Example: '"aa"\n"a"' # # Implement wildcard pattern matching with support for '?' and '*'. # # # '?' Matches any single character. # '*' Matches any se...
2e9b4a7d80c5667b4f51278dea10c51fa9b028d2
AdrianColombus/FindStringer
/SearchForStringer.py
1,118
3.515625
4
def StringerBell(listInput1, listInput2,listInput3,listInput4): length1 = len(listInput1) length2 = len(listInput2) length3 = len(listInput3) length4 = len(listInput4) for i in range(length1): for j in range(length2): for l in range(length3): for h in range(length...
3e21ce91c4b1e28a386e7adeebba4f5d63b21f73
NathaliaMedeiros/dataScienceAcademy
/capitulo_03/ex_01.py
385
4.125
4
""" Crie uma estrutura que pergunte ao usuรกrio qual o dia da semana. Se o dia for igual a Domingo ou igual a sรกbado, imprima na tela "Hoje รฉ dia de descanso", caso contrรกrio imprima na tela "Vocรช precisa trabalhar!" """ dia = input('Que dia รฉ hoje? ') if dia == 'sabado' or dia == 'domingo': print('Hoje รฉ dia de...
ddcd11b5725464d39c7f87b8945679d015fba267
kvablack/semantic-similarity
/network.py
11,017
3.8125
4
import random import numpy as np import pickle class Network(object): """a recurrent neural network with a bias at each step and using the sigmoid as the activation function """ def __init__(self, wordsize): """initializes two weight matricies with Gaussian distributions and one bias v...
e18aeb6604b2a85201b2d9ed0624f2a742f8e1b2
DanielFirpo/Computer-Architecture
/ls8/cpu.py
8,764
3.84375
4
"""CPU functionality.""" import sys #Instruction codes LDI = 0b10000010 PRN = 0b01000111 ADD = 0b10100000 MUL = 0b10100010 HLT = 0b00000001 PUSH = 0b01000101 POP = 0b01000110 CALL = 0b01010000 RET = 0b00010001 CMP = 0b10100111 JMP = 0b01010100 JEQ = 0b01010101 JNE = 0b01010110 #Register Addresses MAR = 0 #Memory Add...
5de29599a01b6701e4c493345d96dc91d0768a91
magtastic/sidastaOnnini
/reiknirit_i_lifupplysingafraedi/1_Counting_DNA_Nucleotides /solution.py
448
3.609375
4
# coding=utf-8 import sys DNA = sys.stdin.readline().strip() #sys.readline() les linu, strip() fjarlรฆgir enter merki def countACGT(text): A = 0 C = 0 G = 0 T = 0 for symbol in text: if symbol == 'A': A = A + 1 elif symbol == 'C': C = C + 1 elif symbo...
f389b4ccdd7fa993fd5fb88ec4910168ae294bfa
gabrielmacey/python-challenge
/PyBank/main.py
2,008
3.515625
4
import os import csv total_months = 0 net_total = 0 last_net = 0 increase = 0 max_money = 0 max_date = "" min_money = 0 min_date = "" total_change = 0 net_change = 0 nc_list = [] profit = [] date = [] #Join the CSV files pybank_csv = os.path.join('Resources', 'PyBank.csv') new_pybank = [] total_profits = [] #Read th...
5ffa106cbe0d3a58604d94ef1588aecd7774b228
themightymuppet/advent
/2020/09.py
1,094
3.578125
4
import re def get_input(file): data = '' with open(file) as f: for line in f: data += line data = re.split(r'\n', data) return data # PI def break_xmas(data): for n, d in enumerate(data): if n > 24: preamble = data[n-25:n] test_num = verify_sum(d...
6b01224cc511e64b0ef8ea19822e6f3bd16ea091
DevaGaneshB/Python
/ptventve.py
169
4.28125
4
#To check Positive/Negative n=input("Enter a value") if(n > 0): print("It is a Positive Number") elif(n<0): print("It is a Negative Number") else: print("Zero")
91588e96fd02913a8c9deb219082e52a5e6b9c2e
DevaGaneshB/Python
/Class Assignment/startEndVowels.py
253
3.5625
4
def startEndVowels(word): stat=False if word[0] in ['a','e','i','o','u','A','E','I','O','U'] and word[-1] in ['a','e','i','o','u','A','E','I','O','U']: stat=True print(stat) a=raw_input("Enter a word") startEndVowels(a)
03e4efc02def809edd9cfcaf2d41740f130f7b9b
MHibbard77/lab6
/delete_account.py
1,813
3.578125
4
import unittest class deleteTests(unittest.TestCase): def setup(self): self.ui.command("create_user Admin AdminPassword") self.ui.command("create_user Supervisor SupervisorPassword") self.ui.commant("create_user TA TAPassword") self.ui.command("create_user Instructor InstructorPass...
2e7bf11334965f8a07865b737f2bf57cc3f1427f
DiegoMeruoca/Python-2-Estruturas-Condicionais
/Ex2-Par ou Impar IF e Else.py
421
4.03125
4
# Exemplo 2 - Utilizando o IF e ELSE num = float(input("Digite um nรบero:")) # Recebe um nรบmero # Quando utilizamos o mรณdulo(%) pegamos o resto da divisรฃo inteira resto = (num % 2) if resto == 1: # Se o resto รฉ igual 1 resultado = "impar" # Resultado recebe impar else: # Senรฃo resultado = "par" # Res...
f332a61bcb440a2f9583b2c31a5db7a6e5cd243a
jsonwulff/MAD_afleveringer
/A1/linreg.py
1,605
3.8125
4
import numpy # NOTE: This template makes use of Python classes. If # you are not yet familiar with this concept, you can # find a short introduction here: # http://introtopython.org/classes.html class LinearRegression(): """ Linear regression implementation. """ def __init__(self): ...
87dfde614fdcb6365781c2862912d45d743e082a
keshane/projecteuler
/2.py
587
3.921875
4
# Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. fi...
a9c619e1ce687efe0dc0cd90eeccfafb7dad330d
mitchklee35/Financial-Analysis-and-Election-Results
/PyBank/Main.py
2,069
3.8125
4
import os import csv # Read path Main_file = os.path.join("..", "PyBank", "budget_data.csv") # Define file stream with open(Main_file) as csvfile: csv_reader = csv.reader(csvfile, delimiter=',') # Enable next row past titles next(csv_reader) revenue = [] date = [] change_in_revenue = [] ...
e6114af07d8795a6db72f799e5b853b4558a3c78
aleksamarkoni/python_examples
/Zadatak_28.py
518
3.875
4
# 28. ะะฐะฟะธัˆะธั‚ะต ะฟั€ะพะณั€ะฐะผ ะทะฐ ะŸะธั‚ั…ะพะฝ ะดะฐ ะฑะธัั‚ะต ะฟั€ะพะฝะฐัˆะปะธ ะดั€ัƒะณะธ ะฝะฐั˜ะฒะตั›ะธ ะฑั€ะพั˜ ะฝะฐ ะปะธัั‚ะธ. lista=[1,2,3,4,5,5,6,8,9,7,9,10,10] lista.sort() i=len(lista)-1 while i>0: if lista[i] > lista[i-1]: print ('Drugi najveci broj u listi',lista,'je',lista[i-1]) break else: i-=1 # ------------------------...
d2096b16b46e12cdde1a0b57046c58708e8237f2
aleksamarkoni/python_examples
/Zadatak7.py
1,949
3.75
4
#ะะฐะฟะธัˆะธั‚ะต ะŸะธั‚ั…ะพะฝ ะฟั€ะพะณั€ะฐะผ ะทะฐ ัƒะบะปะฐัšะฐัšะต ะดัƒะฟะปะธะบะฐั‚ะฐ ัะฐ ะปะธัั‚ะต. L=[1,2,3,4,5,6,7,8,9,10,2,4,6,8,10] d=[] duplikati = set() for x in L: if x not in duplikati: d.append(x) duplikati.add(x) print(d) # --------------------------------------- # ok ovo je ok, zato sto si koristio set, ima i malo bolja fora,...
54582a182859abef91de6400a8f4822a9f1fa3a0
aleksamarkoni/python_examples
/Zadatak_26.py
774
4.03125
4
# 26. ะะฐะฟะธัˆะธั‚ะต ะฟั€ะพะณั€ะฐะผ ะทะฐ ะฟะธั‚ั…ะพะฝ ะดะฐ ะฑะธัั‚ะต ะฟั€ะพะฒะตั€ะธะป ะดะฐ ะปะธ ััƒ ะดะฒะต ะปะธัั‚ะต ะบั€ัƒะถะฝะพ # ะธะดะตะฝั‚ะธั‡ะฝะต. list1 = [10, 10, 0, 0, 10] list2 = [10, 10, 10, 0, 0] list3 = [1, 10, 10, 0, 0] l1=list1[:] l2=list2[:] l3=list3[:] l1.sort() l2.sort() l3.sort() if l1==l2: print('Liste',list1,'i',list2,'su kruzno identicne') else: ...
61681411c695fa46915917656eb7e4f5f6b30408
theodora143/theodoraportfolio
/chinelo/volume.py
128
3.5
4
def volume(w,h,d): vol = w * h * d return vol def main(): volu = volume(1, 2, 3) print(volu) main()
fa35561015986b206e346025bbea788b29e2e76d
labrenzm/cse491-serverz
/cse491-day5/day5.py
611
3.78125
4
def add_2_numbers(x, y): return x+y def divide_2_numbers(x, y): f = x /float(y) return f def get_3rd_value(x): s = x.split(',') value = s[2] return value def get_4th_comma_plus(x): count = 0 s = "" for i in x: if count >= 4: s+=str(i) if i ...
83f0bafde540ac2f413ea3279a22e3535dd8716f
aaguirre28/CS2302
/Main_LAB5A_AA.py
1,559
4.0625
4
""" Alexis Aguirre CS2302: Lab 5, Option A Due on: 11/27/18 """ from HeapImplementation import Heap def main(): h = Heap() # Create a heap object input_list = [ [10, 2, 5, 18, 22, 15, 12, 31, 50, 42, 38, 1, 29, 20, 76, 80, 3], [71, 112, 118, 6, 20, 2, 12, 125, 151, 25, 54, 1, 10...
104edc8313c132b2647c848543042fdf7bacb627
courtneyoftarth/rock-paper-scissors-lizard-spock
/model/move.py
930
3.65625
4
# A Move can be compared to another Move or serialized class Move: count = 0 # Return a new Move with the given name def __init__(self, name): self.__name = name self.__beats = [] Move.count += 1 self.__id = Move.count # Modify this Move such that it can now beat t...
e3dbe16169692441e9c0c6de181a96138b927ad6
pcein/rust-gecskp
/examples/all/traits/a3.py
441
4.09375
4
class Circle: def __init__(self, r): self.radius = r def area(self): return 3.14*(self.radius*self.radius) class Square: def __init__(self,x): self.side = x def area(self): return self.side * self.side # is 'a' bigger than 'b'? def is_bigger(a, b): return a.area() ...
4c8c7faf3bf98fd51763ad55b4df0d2dc66e3347
kachmiel/kurs_codeme
/untitled1/exercise home.py
286
3.75
4
#BMI = 72 / 182**2 #BMI = (masa (kg)) / (wzrost (m))ยฒ #BMI = (waga (kg)) / (wzrost (m))**2 #print("Twoje BMI to:", (waga) / (wzrost**2)) waga = float(input ("Podaj wage w kg: ")) wzrost = float(input ("podaj wzrost w m: ")) bmi = waga / wzrost ** 2 print("Moje BMI to: ", bmi)
f91019b343b4f9be2bcf82357f44913c5ed9ed32
czs108/LeetCode-Solutions
/Medium/6. Zigzag Conversion/solution (1).py
1,137
3.703125
4
# 6. Zigzag Conversion # Runtime: 103 ms, faster than 20.89% of Python3 online submissions for Zigzag Conversion. # Memory Usage: 14.7 MB, less than 13.84% of Python3 online submissions for Zigzag Conversion. class Solution: def convert(self, s: str, numRows: int) -> str: if numRows == 1: re...
9b404272b8f3fc46acd7834b317876fb1540162a
czs108/LeetCode-Solutions
/Easy/136. Single Number/solution (1).py
712
3.53125
4
# 136. Single Number # Runtime: 2116 ms, faster than 9.40% of Python3 online submissions for Single Number. # Memory Usage: 16.2 MB, less than 6.56% of Python3 online submissions for Single Number. class Solution: # List operation def singleNumber(self, nums: list[int]) -> int: # Iterate over all th...
5bbffa50e950169e55a1e4c4434fa7cc9941b372
czs108/LeetCode-Solutions
/Easy/290. Word Pattern/solution (2).py
741
3.78125
4
# 290. Word Pattern # Runtime: 52 ms, faster than 9.17% of Python3 online submissions for Word Pattern. # Memory Usage: 14.2 MB, less than 55.03% of Python3 online submissions for Word Pattern. class Solution: # Single Index Hash Map def wordPattern(self, pattern: str, s: str) -> bool: words = s.spl...
add1fb2f65e5fb60eb6fffc8fa3ae34d51efdffb
czs108/LeetCode-Solutions
/Easy/617. Merge Two Binary Trees/solution (2).py
1,135
4.03125
4
# 617. Merge Two Binary Trees # Runtime: 119 ms, faster than 17.48% of Python3 online submissions for Merge Two Binary Trees. # Memory Usage: 15.2 MB, less than 91.85% of Python3 online submissions for Merge Two Binary Trees. # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, lef...
de417c7634d5be1c0b67283f1cb057ed8a8dccae
czs108/LeetCode-Solutions
/Easy/69. Sqrt(x)/solution (1).py
582
3.8125
4
# 69. Sqrt(x) # Runtime: 64 ms, faster than 17.43% of Python3 online submissions for Sqrt(x). # Memory Usage: 13.8 MB, less than 6.45% of Python3 online submissions for Sqrt(x). class Solution: # Binary Search def mySqrt(self, x: int) -> int: if x == 0 or x == 1: return x low, h...
31883d41ae9fb0b464022f52f02fade6d370fbb5
czs108/LeetCode-Solutions
/Easy/155. Min Stack/solution (2).py
986
3.78125
4
# 155. Min Stack # Runtime: 60 ms, faster than 82.30% of Python3 online submissions for Min Stack. # Memory Usage: 17.4 MB, less than 5.36% of Python3 online submissions for Min Stack. import math class MinStack: def __init__(self) -> None: """ initialize your data structure here. """ ...
fe3177f84ed3428233f67f56637c206fc256c0ab
czs108/LeetCode-Solutions
/Medium/78. Subsets/solution (3).py
827
3.765625
4
# 78. Subsets # Runtime: 20 ms, faster than 99.87% of Python3 online submissions for Subsets. # Memory Usage: 14.3 MB, less than 92.80% of Python3 online submissions for Subsets. class Solution: # Backtracking def subsets(self, nums: list[int]) -> list[list[int]]: if len(nums) == 0: retu...
16c8b370c9c889721191e4097271d4c9df35d5aa
czs108/LeetCode-Solutions
/Easy/977. Squares of a Sorted Array/solution (2).py
854
3.6875
4
# 977. Squares of a Sorted Array # Runtime: 300 ms, faster than 6.84% of Python3 online submissions for Squares of a Sorted Array. # Memory Usage: 16.2 MB, less than 10.10% of Python3 online submissions for Squares of a Sorted Array. class Solution: # Two Pointer def sortedSquares(self, A: list[int]) -> lis...
044a525e330b6c5c9f654c0ac8780f5db2ad9abe
czs108/LeetCode-Solutions
/Easy/21. Merge Two Sorted Lists/solution (2).py
924
3.984375
4
# 21. Merge Two Sorted Lists # Runtime: 36 ms, faster than 64.43% of Python3 online submissions for Merge Two Sorted Lists. # Memory Usage: 13.6 MB, less than 6.61% of Python3 online submissions for Merge Two Sorted Lists. # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # ...
701ae7ffe3ea04b679639d27565f843347345b30
czs108/LeetCode-Solutions
/Easy/35. Search Insert Position/solution (1).py
521
3.796875
4
# 35. Search Insert Position # Runtime: 44 ms, faster than 91.82% of Python3 online submissions for Search Insert Position. # Memory Usage: 14.5 MB, less than 5.97% of Python3 online submissions for Search Insert Position. class Solution: def searchInsert(self, nums: list[int], target: int) -> int: if t...
925fac9eb950987baf7c520b7aa4243e0f846555
czs108/LeetCode-Solutions
/Medium/199. Binary Tree Right Side View/solution (2).py
883
3.875
4
# 199. Binary Tree Right Side View # Runtime: 36 ms, faster than 56.76% of Python3 online submissions for Binary Tree Right Side View. # Memory Usage: 14.3 MB, less than 20.76% of Python3 online submissions for Binary Tree Right Side View. # Definition for a binary tree node. # class TreeNode: # def __init__(se...
03a928b74481304c3f6009a2ef03db1c4b14c003
czs108/LeetCode-Solutions
/Medium/707. Design Linked List/solution (1).py
2,591
4.3125
4
# 707. Design Linked List # Runtime: 256 ms, faster than 67.19% of Python3 online submissions for Design Linked List. # Memory Usage: 15.2 MB, less than 36.23% of Python3 online submissions for Design Linked List. class ListNode: # Singly Linked List def __init__(self, x: int) -> None: self.val: int...
3bc3e7f69114d5a1f37032618071644e4f22ee20
czs108/LeetCode-Solutions
/Medium/209. Minimum Size Subarray Sum/solution (1).py
675
3.671875
4
# 209. Minimum Size Subarray Sum # Runtime: 73 ms, faster than 68.51% of Python3 online submissions for Minimum Size Subarray Sum. # Memory Usage: 16.7 MB, less than 42.21% of Python3 online submissions for Minimum Size Subarray Sum. class Solution: # Two Pointers | Sliding Window def minSubArrayLen(self, t...
77430105f84cce495f3e65ebb5ab1af4b1d88ba2
czs108/LeetCode-Solutions
/Medium/1130. Minimum Cost Tree From Leaf Values/solution (1).py
964
3.75
4
# 1130. Minimum Cost Tree From Leaf Values # Runtime: 304 ms, faster than 16.66% of Python3 online submissions for Minimum Cost Tree From Leaf Values. # Memory Usage: 14.9 MB, less than 9.62% of Python3 online submissions for Minimum Cost Tree From Leaf Values. import math class Solution: def mctFromLeafValues...
f058c95b2b61b8d7a79fbd9e5ed0050d8c1b46d9
czs108/LeetCode-Solutions
/Easy/844. Backspace String Compare/solution (1).py
600
3.734375
4
# 844. Backspace String Compare # Runtime: 24 ms, faster than 96.27% of Python3 online submissions for Backspace String Compare. # Memory Usage: 14.3 MB, less than 51.80% of Python3 online submissions for Backspace String Compare. class Solution: # Build String def backspaceCompare(self, s: str, t: str) -> ...
c977241b4626608fe7f08e9aa59be2d864842bf2
czs108/LeetCode-Solutions
/Medium/1091. Shortest Path in Binary Matrix/solution (1).py
1,337
3.84375
4
# 1091. Shortest Path in Binary Matrix # Runtime: 752 ms, faster than 56.15% of Python3 online submissions for Shortest Path in Binary Matrix. # Memory Usage: 14.7 MB, less than 78.38% of Python3 online submissions for Shortest Path in Binary Matrix. class Solution: # Breadth-first Search def shortestPathBi...
64e59579c0dd67affbe4a9b7472875883febacb6
czs108/LeetCode-Solutions
/Easy/70. Climbing Stairs/solution (6).py
594
3.671875
4
# 70. Climbing Stairs class Solution: # Recursion with Memoization def __init__(self) -> None: self._mem: list[int] = None def climbStairs(self, n: int) -> int: self._mem = [-1 for _ in range(n + 1)] return self._climb_stairs(n) def _climb_stairs(self, n: int) -> int: ...
4d9e60f07b1249cb164bd4cc6e8fcb05bb7564f5
czs108/LeetCode-Solutions
/Medium/322. Coin Change/solution (4).py
503
3.5625
4
# 322. Coin Change # 15 / 182 test cases passed. # Time Limit Exceeded import math class Solution: # Recursive def coinChange(self, coins: list[int], amount: int) -> int: if amount == 0: return 0 count = math.inf for n in coins: if amount >= n: ...
09b532fdb4e6c76339de70639074d12c40f4157d
czs108/LeetCode-Solutions
/Medium/201. Bitwise AND of Numbers Range/solution (1).py
501
3.796875
4
# 201. Bitwise AND of Numbers Range # Runtime: 60 ms, faster than 65.36% of Python3 online submissions for Bitwise AND of Numbers Range. # Memory Usage: 14.2 MB, less than 58.10% of Python3 online submissions for Bitwise AND of Numbers Range. class Solution: # Bit Shift | Common Prefix def rangeBitwiseAnd(s...
e0ec8777f3c2c2682d54e8c49db5b4e3ca9fa438
czs108/LeetCode-Solutions
/Easy/1046. Last Stone Weight/solution (3).py
675
3.5
4
# 1046. Last Stone Weight # Runtime: 32 ms, faster than 70.58% of Python3 online submissions for Last Stone Weight. # Memory Usage: 14.4 MB, less than 21.02% of Python3 online submissions for Last Stone Weight. import heapq class Solution: # Heap-Based Simulation def lastStoneWeight(self, stones: list[int]...
b0d479e7b4c8d99129f51d9550e3bcd9a9ad2d62
czs108/LeetCode-Solutions
/Medium/338. Counting Bits/solution (1).py
460
3.6875
4
# 338. Counting Bits # Runtime: 216 ms, faster than 9.27% of Python3 online submissions for Counting Bits. # Memory Usage: 20.7 MB, less than 5.00% of Python3 online submissions for Counting Bits. class Solution: def countBits(self, num: int) -> list[int]: count = [] for i in range(num + 1): ...
aa0c709514fc09f684f233fc61894edfff4791d1
czs108/LeetCode-Solutions
/Medium/78. Subsets/solution (1).py
663
3.6875
4
# 78. Subsets # Runtime: 32 ms, faster than 77.06% of Python3 online submissions for Subsets. # Memory Usage: 14.4 MB, less than 17.60% of Python3 online submissions for Subsets. class Solution: # Backtracking def subsets(self, nums: list[int]) -> list[list[int]]: if len(nums) == 0: retu...
723cb99736dd56c32bb206c33462887446943177
czs108/LeetCode-Solutions
/Easy/119. Pascal's Triangle II/solution (1).py
795
3.6875
4
# 119. Pascal's Triangle II # Runtime: 24 ms, faster than 92.64% of Python3 online submissions for Pascal's Triangle II. # Memory Usage: 14 MB, less than 7.69% of Python3 online submissions for Pascal's Triangle II. class Solution: def getRow(self, rowIndex: int) -> list[int]: triangle = [] for ...
bcaee185a6d376a089442d3fd1965b691cab1a41
czs108/LeetCode-Solutions
/Medium/289. Game of Life/solution (1).py
1,532
3.859375
4
# 289. Game of Life class Solution: # Neighbors array to find 8 neighboring cells for a given cell _NEIGHBORS = [(1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1), (1, 1)] def gameOfLife(self, board: list[list[int]]) -> None: """ Do not return anything, modify board in-place in...