blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 3.06M | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 3.06M |
|---|---|---|---|---|---|---|
b29571ed3f997a0b2dfc5fcceefb41050f009feb | bovard/advent_of_code_2016 | /01/part_one.py | 599 | 3.765625 | 4 | from maps import Direction, Location
with open('input.txt') as f:
instructions = f.read().strip().split(', ')
# start at 0,0 facing North
start = Location(0, 0)
direction = Direction.NORTH
current = start
for inst in instructions:
lr = inst[0]
n = int(inst[1:])
# turn left or right
if lr == 'L'... |
a1c1248449fc07ddce4ef66ab33cdc9f42dd8653 | mcttn1/python | /parameter.py | 10,310 | 4.09375 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 16 16:52:31 2018
@author: huashuo
"""
#Python的函数定义,除了正常定义的必选参数外,还可以使用默认参数、
#可变参数和关键字参数,使得函数定义出来的接口,不但能处理复杂的参数,还可以简化调用者的代码。
# #位置参数
# =============================================================================
# #我们先写一个计算x2的函数
# def power(x):
# return... |
1eb516ec2ab4265e7fcd8cabf42dc7e3b63acd6c | hub851/HIT137-Group-11-Assignment-2 | /210212_PY_HIT137_Assignement 2 Part 1-Group 11.py | 1,468 | 3.609375 | 4 | from turtle import *
a = int(input("How many flowers would you like?: "))
ht()
pu()
goto(((a/2)*-400),0)
screensize((400*a)+400,600)
bgcolor("skyblue")
speed(50)
pd()
b = 1
for i in range (a):
color("green","green")
begin_fill()
for i in range(1):
forward(10)
right(90)
forward(250)
... |
22d1c4d381fbbf7cbf52568137b1b079f41e1e3c | RicardoBaniski/Python | /Opet/4_Periodo/Scripts_CEV/Mundo_01/Aula009.py | 1,449 | 4.78125 | 5 | print('''Nessa aula, vamos aprender operações com String no Python. As principais operações que vamos aprender são o Fatiamento de String, Análise com len(), count(), find(), transformações com replace(), upper(), lower(), capitalize(), title(), strip(), junção com join().
''')
frase = 'Curso em Video Python'
print(f... |
4b9fbf78ffbe61cd1eee106b8929079f972ada80 | RicardoBaniski/Python | /Opet/4_Periodo/Scripts_CEV/Mundo_01/Desafio012.py | 170 | 3.53125 | 4 | preco = int(input('Preço: '))
d = 5
desconto = preco * (d/100)
total = preco - desconto
print('Desconto de {}'.format(desconto))
print('O total é {}'.format(total))
|
477b8432b498cca5243fd4555e02f2bb0d0e90d7 | RicardoBaniski/Python | /Opet/4_Periodo/Scripts_CEV/Mundo_02/Desafio041.py | 304 | 3.953125 | 4 | from datetime import date
hoje = date.today()
nascimento = int(input('Data de nascimento: '))
idade = hoje.year-nascimento
if idade <= 9:
print('MIRIM')
elif idade <= 14:
print('INFANTIL')
elif idade <= 19:
print('JUNIOR')
elif idade <= 20:
print('SÊNIOR')
else:
print('MASTER')
|
c2f65bfedca5938fd832d18e2c924e789d146da1 | RicardoBaniski/Python | /Opet/5_Periodo/CifraDeCesar.py | 1,290 | 3.75 | 4 | # RICARDO BANISKI - 1201800164
alfabeto = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz '
def criptografar(alfabeto, texto, chave):
texto_criptografado = ''
for caractere in texto:
if caractere in alfabeto:
index = alfabeto.find(caractere) + chave
if index >= len(alfa... |
0bd4e81ad9d204b1c6d546b5095fbce1e2090d09 | RicardoBaniski/Python | /Opet/4_Periodo/Scripts_CEV/Mundo_01/Desafio016.py | 121 | 3.828125 | 4 | import math
n = float(input('Digite um numero Real: '))
print('Parte inteira do numero Real {}'.format(math.trunc(n)))
|
098136c8b597b81e8cc2c769e837f54d1e0046c4 | RicardoBaniski/Python | /Opet/4_Periodo/Scripts_CEV/Mundo_01/Desafio029.py | 233 | 3.765625 | 4 | velocidade = int(input('Qual a velocidade do carro: '))
if velocidade > 80:
print('Você foi multado em R${:.2f} por excesso de velocidade'.format((velocidade-80)*7))
else:
print('Você esta dentro do limite de velocidade')
|
85d84d9c937233fb243c2a67a482c84d778bb60b | nicolas-huber/reddit-dailyprogrammer | /unusualBases.py | 1,734 | 4.3125 | 4 | # Decimal to "Base Fib" - "Base Fib" to Decimal Converter
# challenge url: "https://www.reddit.com/r/dailyprogrammer/comments/5196fi/20160905_challenge_282_easy_unusual_bases/"
# Base Fib: use (1) or don't use (0) a Fibonacci Number to create any positive integer
# example:
# 13 8 5 3 2 1 1
# 1 0 0 ... |
9a803033d24f76a0d9e71afa22238385872de5c7 | ZacharyAngelucci/SeniorProject2019TBA | /datagen/general.py | 266 | 3.828125 | 4 | import random
def yesno_question(chance=.5):
""" Returns a yes or a no
Args:
chance (float): Chance for yes result [0->0.999...]
Defaults to 0.5
"""
if random.random() <= chance:
return "Yes"
else:
return "No" |
bc7608a79c1dcecb188038ccd921cd731a62e555 | Seraffina-93/Hacking-with-Python | /Password Cracking/cryptforce.py | 789 | 3.828125 | 4 | #!/usr/bin/python
import crypt
from termcolor import colored
def crackPass(cryptWord):
salt = cryptWord[0:2]
dictionary = open("dictionary.txt", 'r')
for word in dictionary.readlines():
word = word.strip('\n')
cryptPass = crypt.crypt(word, salt)
if (cryptWord == cryptPass):
print (colored("[+] Found passw... |
dc7846f11f5728a9ab5aa3421fe3c3b83c0b2b43 | czqzju/10_Days_Of_Statistics | /day5/Normal_Distribution_II.py | 481 | 3.546875 | 4 | #https://www.hackerrank.com/challenges/s10-normal-distribution-2/problem
import math
def normal_distribution(x, u, stdd):
return 0.5 + 0.5 * math.erf((x - u) / (stdd * 2 ** 0.5))
if __name__ == "__main__":
u = 70
stdd = 10
res1 = 1 - normal_distribution(80, u, stdd)
res2 = 1 - normal_distributi... |
503f39efb0709290c23d3d882563e91bfec6dd6c | LJ-Godfrey/Learn-to-code | /Encryption-101/01/loops.py | 783 | 3.96875 | 4 | # This code is a basic loop that runs something x number of times
inp = input("Enter something...: ")
#This is an infinite loop that breaks when the letter 'q' is entered
while inp != 'q':
print("You entered: {}".format(inp))
inp = input("Enter something else: ")
'''
i = 0
while i < 10:
print(i)
i = i + 1
for i... |
b0b353eb1b6e426d235a046850ba74aea627d7a2 | LJ-Godfrey/Learn-to-code | /Encryption-101/encryption_project/encrypt.py | 1,178 | 4.25 | 4 | # This file contains various encryption methods, for use in an encryption / decryption program
def caesar(string):
res = str()
for letter in string:
if letter.lower() >= 'a' and letter.lower() <= 'm':
res += chr(ord(letter) + 13)
elif letter.lower() >= 'n' and letter.lower() <= 'z':... |
5ab248c3454e6d44f06b1f5ee5e34469c343e108 | mgh3326/GyeonggiBigDataSpecialist | /python_exam/0727/class_value_practice.py | 507 | 3.828125 | 4 | class Car:
color = '' # 인스턴스 변수
speed = 0 # 인스턴스 변수
count = 0 # 클래스 변수
def __init__(self):
self.speed = 0
Car.count += 1
myCar1, myCar2 = None, None
myCar1 = Car()
myCar1.speed = 30
myCar2 = Car()
myCar2.speed = 60
myCar2.count += 1
print('자동차1의 현재 속도는 %dkm, 생산된 자동차는 총 %d대 ' % (myCar1.speed, Car... |
0df23278174bc73727e05e9e946754be4204bae4 | mgh3326/GyeonggiBigDataSpecialist | /python_exam/0726/factorail_practice.py | 163 | 3.84375 | 4 | num = input("정수를 입력하시오 : ")
result = 1
for i in range(int(num)):
result = result * (i + 1)
print(str(num) + "!은" + str(result) + "이다.")
|
49ed58e490d2080a68ec00b60a9d204f41fa10e0 | mgh3326/GyeonggiBigDataSpecialist | /python_exam/0801/tensorflow_exam01.py | 1,701 | 3.65625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 13 10:06:04 2017
@author: student
"""
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
matrix1 = tf.constant([[3., 3.]])
# 2x1 행렬을 만드는 constant op을 만들어봅시다.
# Create another Constant that produces a 2x1 matrix... |
1445db9e8404002912add906b8e5c6986bec42c8 | tt-n-walters/thebridge-python | /downloader.py | 493 | 3.578125 | 4 | import requests
print("Enter url to download:")
url = input(">> ")
print("Enter filename to save:")
filename = input(">> ")
# Download the url
print("Downloading...")
response = requests.get(url)
# Check the download succeeded
if not response.status_code == 200:
print("Download error.")
exit()
print("Dow... |
5032238dacd0d2d0fc51d50833bcd13e49bc51cd | nikita26078/Python-exercises | /ex12/3.py | 569 | 3.828125 | 4 | def superset(a, b):
if a > b:
print(f'Объект {a} является чистым супермножеством')
elif a < b:
print(f'Объект {b} является чистым супермножеством')
elif a == b:
print('Множества равны')
else:
print('Супермножество не обнаружено')
set1 = {2, 9, 8, 5}
set2 = {... |
6c548753a2ecc08cc68c2e3d96411f62e2a067e8 | Frazl/algorithms-data-structures-python-notes | /Algorithms/Graphs/breadthfirstsearch.py | 3,350 | 3.625 | 4 | #!/usr/bin/env python3
from collections import defaultdict
# Breadth First Search
# Uses the graph from ../DataStructures/graph.py
# Uses the queue from ../DataStructures/queue.py
# Includes Breadth First Paths (Shortest Path from source vertice to another based on edges (not weights))
# Operations
# path_to --> ... |
8fc56cb02c388fee48e9c777c33e2169f3535b77 | Frazl/algorithms-data-structures-python-notes | /DataStructures/graph.py | 2,370 | 3.75 | 4 | #!/usr/bin/env python3
from collections import defaultdict
# Simple Graph class. This uses the adjaceny lists variation of a graph.
# This graph uses a symbol table to limit memory usage. e.g. Instead of storing possibly large strings we record the value and link it to an number in a list.
# The alternative version... |
dbc24899f01dd38cb9f8d7501b5434850fcb790f | gangqing/PythonExercise | /p01_阶乘.py | 613 | 3.5 | 4 |
def fac1(n):
result = 1
for i in range(2,n+1):
result *= i
return result
def fac2(n):
result = [1]
for i in range(2,n+1):
mul(result,i)
return toString(result)
def mul(result,a):
add =0
for position in range(len(result)):
aa = result[position] * a + add
... |
7f430ce04b78b846d49a928b2a47994105fd3ba5 | gangqing/PythonExercise | /p04_囚犯.py | 796 | 3.5625 | 4 |
import random
def func(n):
list = [False] * n
light = False
while False in list:
countor = 0
a = random.randint(0,n-1)
print(f"{getName(a,countor)},{getWake(list[a])},{getLight(light)}")
prisoner = list[a]
if a == countor and light:
list[a] = True
... |
68e47a9d12af2369f9f84a721554083dd371f08e | Nickkun/day3 | /function.py | 279 | 3.875 | 4 |
def hello(name='Nick', age='10'):
print("Hello, " + name )
print(age + " years old")
# typing = input("What is your name? ")
# hello(typing)
tp1 = input("Your Name: ")
tp2 = input("How old are you? ")
# hello(name, age)
# hello(name)
# hello()
hello(age=tp2, name=tp1) |
a302ba4f56d279639dcb66cddd9a8c5191edf94c | Nickkun/day3 | /classCal.py | 953 | 3.890625 | 4 | class Cal():
def __init__(self, value):
self.value = value
def result(self):
print(self.value)
def add(self, input_value):
self.value += input_value
#self.value = self.value + input_value
def sub(self, input_value):
self.value -= input_value
def mul(se... |
99e7d3e826da13061bec7b5e9ed7de9add6e4a60 | hpcflow/pyinstaller-test | /hpcflow/parameters.py | 4,134 | 3.65625 | 4 | import copy
import numpy as np
class Parameter:
def __init__(self, name):
self.name = name
class Input(Parameter):
def __init__(self, name):
super().__init__(name)
def __repr__(self):
return f'<Input({self.name})>'
def __eq__(self, other):
"""Two Inputs are consid... |
0dbf1a44855066d066ca5d036b4712ea90f97bc6 | Moby5/myleetcode | /python/155_Min_Stack.py | 3,989 | 3.6875 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
https://leetcode.com/problems/min-stack/description/
[LeetCode]155. Min Stack
题目描述:
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
push(x) -- Push element x onto stack.
pop() -- Removes the element on top of the stack.
top(... |
fd1f0836c9c89a66ff6a555f48577538e398f026 | Moby5/myleetcode | /python/671_Second_Minimum_Node_In_a_Binary_Tree.py | 2,525 | 4.125 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
@File: 671_Second_Minimum_Node_In_a_Binary_Tree.py
@Desc:
@Author: Abby Mo
@Date Created: 2018-3-10
"""
"""
Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node... |
91dc5dea5001604537abc3760d68c22add6737c8 | Moby5/myleetcode | /python/396_Rotate_Function.py | 2,452 | 3.90625 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
http://bookshadow.com/weblog/2016/09/11/leetcode-rotate-function/
396. Rotate Function
Given an array of integers A and let n to be its length.
Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a "rotation function" F on A as follow:
... |
b76d2e373ea53f6ef7498888b0a80365bc48ec38 | Moby5/myleetcode | /python/532_K-diff_Pairs_in_an_Array.py | 2,592 | 4.125 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
LeetCode 532. K-diff Pairs in an Array
Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both numbers in the array and their absolute differen... |
94ad5d8a58263a018c0166cc84be1875cf7427b4 | Moby5/myleetcode | /python/111_Minimum_Depth_of_Binary_Tree.py | 1,526 | 4.03125 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
[LeetCode] 111. Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
题目大意:
给定一棵二叉树,计算其最小深度。
最小深度是指从根节点出发到达最近的叶子节点所需要经过的节点个数。
解题思路:
DFS或者BFS均可... |
01db338d18893fed2689056c5b9d20ae3f102b06 | Moby5/myleetcode | /python/225_Implement_Stack_using_Queues.py | 3,792 | 4.03125 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
http://bookshadow.com/weblog/2015/06/11/leetcode-implement-stack-using-queues/
225. Implement Stack using Queues
Implement the following operations of a stack using queues.
push(x) -- Push element x onto stack.
pop() -- Removes the element on top of the stack.
top() -- Get the... |
87549ca576db27ba40347d375273a4014275e55a | Moby5/myleetcode | /python/232_Implement_Queue_using_Stacks.py | 4,434 | 3.96875 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
http://bookshadow.com/weblog/2015/07/07/leetcode-implement-queue-using-stacks/
232. Implement Queue using Stacks
Implement the following operations of a queue using stacks.
push(x) -- Push element x to the back of queue.
pop() -- Removes the element from in front of queue.
pe... |
1956ea7ce6d5955b343157031ad1089928bf0dfa | Moby5/myleetcode | /python/202_Happy_Number.py | 2,098 | 4.125 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
202. Happy Number
Write an algorithm to determine if a number is "happy".
A happy number is a number defined by the following process:
Starting with any positive integer, replace the number by the sum of the squares of its digits,
and repeat the process until the number equ... |
3d7405e5cb56a877aba49c4c6cbb74fec7487dbd | Moby5/myleetcode | /python/13_Roman_to_Integer.py | 3,949 | 4 | 4 | #!/usr/bin/env python
# coding=utf-8
# Date: 2018-07-23
"""
https://leetcode.com/problems/roman-to-integer/description/
13. Roman to Integer
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Symbol Value
I 1
V 5
X 10
L 50
C ... |
a763c9d6e4f909126e046c04ee2baa79a24923ea | Moby5/myleetcode | /python/62_Unique_Paths.py | 3,652 | 4.28125 | 4 | #!/usr/bin/env python
# coding=utf-8
# Date: 2018-09-12
"""
https://leetcode.com/problems/unique-paths/description/
62. Unique Paths
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 right at any point in time. The robot is trying... |
bd4619b0c4c69fddaa93c8e896a89873c74e245a | Moby5/myleetcode | /python/414_Third_Maximum_Number.py | 2,199 | 4.15625 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
http://bookshadow.com/weblog/2016/10/09/leetcode-third-maximum-number/
414. Third Maximum Number
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).
Example ... |
6fb4526978401246c9407b8bbcaeb87c7c86d611 | Moby5/myleetcode | /python/389_Find_the_Difference.py | 2,215 | 3.734375 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
http://bookshadow.com/weblog/2016/08/28/leetcode-find-the-difference/
389. Find the Difference
Given two strings s and t which consist of only lowercase letters.
String t is generated by random shuffling string s and then add one more letter at a random position.
Find the l... |
c3a924baa0f8266ed3900f897439da2766392df5 | Moby5/myleetcode | /python/693_Binary_Number_with_Alternating_Bits.py | 1,729 | 4 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
http://bookshadow.com/weblog/2017/10/08/leetcode-binary-number-with-alternating-bits/
693. Binary Number with Alternating Bits
Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.
Example 1:
Input: 5... |
435ea91454abcafece1d68c23106f565bc004030 | Moby5/myleetcode | /python/263_Ugly_Number.py | 1,258 | 4.1875 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
http://bookshadow.com/weblog/2015/08/19/leetcode-ugly-number/
263. Ugly Number
Write a program to check whether a given number is an ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly sinc... |
8275fed43d66d21fc20c3fde3881859b657ba757 | Moby5/myleetcode | /python/401_Binary_Watch.py | 2,926 | 3.765625 | 4 | #!/usr/bin/env python
# coding=utf-8
"""
http://bookshadow.com/weblog/2016/09/18/leetcode-binary-watch/
LeetCode 401. Binary Watch
A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).
Each LED represents a zero or one, with the least signi... |
c5e27b7b53627a3de5c75877317753b0a3a810be | Moby5/myleetcode | /python/289_Game_of_Life.py | 4,331 | 4.1875 | 4 | #!/usr/bin/env python
# coding=utf-8
# Date: 2018-10-30
# File: 289_Game_of_Life.py
"""
According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970."
Given a board with m by n cells, each cell has an initia... |
a3f0ed60542ab8174c23174d1a48c8e2273b9e50 | Moby5/myleetcode | /python/640_Solve_the_Equation.py | 2,492 | 4.3125 | 4 | #!/usr/bin/env python
# coding=utf-8
# 566_reshape_the_matrix.py
"""
http://bookshadow.com/weblog/2017/07/09/leetcode-solve-the-equation/
LeetCode 640. Solve the Equation
Solve a given equation and return the value of x in the form of string "x=#value". The equation contains only '+', '-' operation, the variable x a... |
74acc85bd825153d20f67ef4f2d3f5c3cd78c4ef | GarySun527/Python | /elementary/forWhile.py | 227 | 3.6875 | 4 | #for loop
ls = [12, 64, 56, 89, 72, 90]
for grade in ls:
print(grade)
while grade >30:
print(">30")
break
print('end')
print("*********************")
for x in [1,2,3,4,5]:
for y in (9,8,7,6):
print(x+y)
print("end")
|
549ae44ba1517ca134e2677a63cc3fe5cfb5f205 | joaoribas35/distance_calculator | /app/services/calculate_distance.py | 943 | 4.34375 | 4 | import haversine as hs
def calculate_distance(coordinates):
""" Will calculate the distance from Saint Basil's Cathedral and the address provided by client usind Haversine python lib. Saint Basil's Cathedral is used as an approximation to define whether the provided address is located inside the MKAD Moscow Ring ... |
fe2e03f8ab417fdea23b1804a79290c0d62d4dd4 | chuming03403/python3 | /algorithmAndDataStructure/rotate.py | 753 | 3.546875 | 4 | class Solution:
def rotate(self, nums: List[int], k: int) -> None:
"""
Do not return anything, modify nums in-place instead.
https://leetcode-cn.com/problems/rotate-array
"""
leng = len(nums);
k %= leng;
loop_time = current = start = 0;
while True:
... |
d533297457a4d78636b6c8e78241327454767d4d | KaranKaira/StorePassword | /STOREPASSWORDS.py | 4,981 | 4.09375 | 4 | #First project
#why?? Just to get a hang of project building
# I will be using tkinter for gui
# This app is for storing passwords offline in a encrypted manner
#Day1 :8,july,19
import tkinter as tk
import tkinter.messagebox as msgbox
import os
HEIGHT = 300
WIDTH = 600
root = tk.Tk()
root.title("ST... |
1097684fdea2550be363cb1fa189bada61273464 | LichKing-lee/python_start | /test/MultiplicationTable.py | 113 | 3.78125 | 4 | for num1 in range(2, 10):
for num2 in range(1, 10):
print("%s * %s = %s" % (num1, num2, num1 * num2)) |
c15d22e2cf2192b4e1ef7df1e1d609f5a12f4ae9 | mandycrose/module-02 | /ch04_conditionals/ch04_mandy.py | 5,175 | 3.890625 | 4 | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import random
import datetime
import time
print("hello")
def luckyNumberRandom():
name= input ("please type your name here: ")
print ("hello", name.upper())
number= int(input("please give a number: "))
print ("your luck num... |
4c0f910b6f9f0dc93578103a3c11a9c0478fd2c7 | mandycrose/module-02 | /ch09_lists_tuples/ch09_mandy.py | 2,137 | 3.890625 | 4 | ### -*- coding: utf-8 -*-
##"""
##Created on Thu Dec 13 09:45:32 2018
##
##@author: 612436112
##"""
################################################################
#lists and tuples
################################################################
#### task 1 ########
my_favourite_fruits = ["apple", "orange", "banana... |
536bf2470f47c6353bc674b6c1efd668f8c03473 | nonbinaryprogrammer/python-poet | /sentence_generator.py | 787 | 4.15625 | 4 | import random
from datetime import datetime
from dictionary import Words
#initializes the dictionary so that we can use the words
words = Words();
#makes the random number generator more random
random.seed(datetime.now)
#gets 3 random numbers between 0 and the length of each list of words
random1 = random.randint(0, ... |
b28c0c119986cc5038a4432cb60f283edbbc1fe3 | geri-brs/machine-learning | /1-python-learning/absolute_sorting.py | 317 | 3.640625 | 4 | def absolute(x):
if x >= 0:
return x
else:
return -x
def sorting(tup):
abs_list = []
for i in(tup):
abs_list.append(absolute(i))
return abs_list
if __name__ == '__main__':
a = (-20, -5, 10, 15)
print(sorted(a, None, lambda a: abs(a))
|
056f8e9d8e18434439f808ff843a6ffa33ded582 | geri-brs/machine-learning | /1-python-learning/best_stock.py | 360 | 3.578125 | 4 | def best_stock(data):
max_key = ""
max_value = 0
for i in (data):
if (data[i] > max_value):
max_key = i
max_value = data[i]
return max_key
if __name__ == '__main__':
print("Example:")
print(best_stock({
'CAC': 10.0,
'ATX... |
29c9b1126c9d887ee79a14ab4f84d2b0649d18bd | geri-brs/machine-learning | /1-python-learning/long repeat.py | 356 | 3.75 | 4 | str = "ddvvrwwwrggg"
max_len = 0
counter = 0
for i in range(0, len(str)-1):
if (str[i] == str[i+1]):
counter = counter +1
print("if counter erteke: ", counter)
if (counter > max_len):
max_len = counter + 1
print("max_len: ", max_len)
else:
c... |
7edee44532645aa8d53cb926de43472b2d1a5e88 | geri-brs/machine-learning | /1-python-learning/NonUniqueElements.py | 195 | 3.6875 | 4 | numbers = [1,2,3,1,3]
shadow = numbers
counter = 0
shadow.sort()
for i in shadow:
for j=i+1 in shadow:
if (shadow[i] == shadow[j]): counter = counter + 1
print(counter)
|
c5047dc2219680d70c2510dc19397499c3f7b23e | mraduldubey/HackerRank-Python-Challenge | /Sets/l32.py | 346 | 3.828125 | 4 | # Enter your code here. Read input from STDIN. Print output to STDOUT
# Enter your code here. Read input from STDIN. Print output to STDOUT
eng_n = int(raw_input().strip())
eng = set(map(int,raw_input().split()))
fren_n = int(raw_input().strip())
fren = map(int,raw_input().split())
print len(eng.difference(fren)) #int... |
64f25a6b6a5bdef76122207cad6cca342f7e6c2b | ggb367/Fall-2019 | /366K/hw2/hw2-3.py | 248 | 3.84375 | 4 | import matplotlib.pyplot as plt
import numpy as np
du = np.linspace(1, 5, 100)
g = np.divide(1, np.square(du))
plt.plot(du, g)
plt.xlabel('Distance in Earth Radii')
plt.ylabel('g/g_0')
plt.title('Inverse Square Decay of Gravity Force')
plt.show()
|
40920683637061713bbc5644ef00969ea16444fd | aralyekta/Data-Structures | /stack/singly.py | 6,007 | 4.25 | 4 | # Our methods are:
# Count, index, insert, remove, append, pop, print, delete, clear, contains, peeklast, peekfirst
class Node: #The class for a node of the linked list
def __init__(self, data):
self.data = data
self.ptr = None
class linkedList: #The class for the linked list
def __init__(self... |
5773535452e99d26aaea7ec8bb32fe803be868fc | jinensetpal/csjournal | /hashsep.py | 139 | 3.96875 | 4 | #!/usr/bin/python3
with open("file.txt", "r") as f:
for i in f.readlines():
for j in i.split():
print(j, end="#")
|
b09738ccf9f02bc0532aefee16a67b5823bf9ec7 | yongseongCho/python_201911 | /Hello_Python.py | 547 | 3.828125 | 4 | # -*- coding: utf-8 -*-
# 주석문 : 소스 코드의 설명을 위해서
# 사용되는 설명문
"""
여러
라인에
걸친
설명문
"""
# 변수의 선언
number = 10
number = 15
# 출력문 사용
# - print 함수를 사용
print(number)
print("Hello Python~!")
print('오늘은 {0}월 {1}일 입니다.'.format(11, 18))
import tkinter as tk
window=tk.Tk()
window.title('Hello Python Win... |
6be96a3fae4524ed7d0121635c03e0e3f60518ee | yongseongCho/python_201911 | /day_03/list_05.py | 1,071 | 3.53125 | 4 | # -*- coding: utf-8 -*-
list_1 = [1,2,3,4,5,6,7,8,9,10]
print(list_1)
# 리스트의 데이터를 삭제하는 방법
# 1. 슬라이싱 연산과 빈 리스트 객체를 활용하는 방법
list_1[3:6] = []
print(list_1)
# 리스트의 데이터를 삭제하는 방법
# 2. del 연산자를 활용하는 방법
del list_1[3]
print(list_1)
# 리스트의 데이터를 삭제하는 방법
# 3. remove 메소드를 활용하는 방법
# - 특정 데이터를 검색하여 삭제
# - 아래의 코드... |
0c295d77d6d7949b751ca0dfdae7d5e0565e8e88 | yongseongCho/python_201911 | /day_05/if_03_EX_2.py | 612 | 3.96875 | 4 | # -*- coding: utf-8 -*-
# 사용자에게 3과목의 성적을 입력받아
# 평균점수가 90점이상이면 합격, 미만이면
# 불합격을 출력하세요
score_1 = int(input('1번째 성적을 입력하세요 : '))
score_2 = int(input('2번째 성적을 입력하세요 : '))
score_3 = int(input('3번째 성적을 입력하세요 : '))
# 총점 처리
tot = score_1 + score_2 + score_3
# 평균 처리
avg = tot / 3
# 평균 점수에 따라 합격/불합격 처리
if avg... |
495211f83fdd33e53395370d37826ef203d048fd | yongseongCho/python_201911 | /day_04/set_03.py | 665 | 3.609375 | 4 | # -*- coding: utf-8 -*-
# Set 타입의 데이터를 활용한 &(and), |(or), -
numbers_2 = set([2,4,6,8,10,12])
numbers_3 = set([3,6,9,12])
# Set 변수가 저장하고 있는 데이터의 교집합 추출
# (중복 데이터 추출)
print(numbers_2 & numbers_3)
# Set 변수가 저장하고 있는 데이터의 합집합 추출
# (중복되는 데이터는 하나만 유지)
print(numbers_2 | numbers_3)
# Set 변수가 저장하고 있는 데이터의 차집합 추출
#... |
65eee29729b7d55eaafc31fa16848d2fd29296c9 | yongseongCho/python_201911 | /day_17/matplotlib_10.py | 693 | 3.875 | 4 | # -*- coding: utf-8 -*-
from matplotlib import pyplot as plt
x1 = list(range(1, 101))
y1 = list(map(lambda x : x * 1.2, x1))
x2 = list(range(1, 101))
y2 = list(map(lambda x : x * 1.7, x2))
plt.title('matplotlib example')
plt.xlabel('x label')
plt.ylabel('y label')
# 다수개의 그래프를 생성하는 경우
# 서브플롯 설정 방법
#... |
1b296bb81cc84ad4cdf0e4f5e75096c5a06fc81a | yongseongCho/python_201911 | /day_05/if_02.py | 648 | 3.96875 | 4 | # -*- coding: utf-8 -*-
# input 함수
# 기본 입력(키보드)을 처리할 수 있는 함수
# 변수명 = input("Message")
# Message가 화면에 출력이 되고, 키보드로 입력된 정보가
# '문자열'로 변수에 대입됨
number = input('숫자를 입력하세요 : ')
print(f'입력된 숫자는 {number} 입니다')
# input 함수를 통해서 대입된 데이터는
# 문자열 타입입니다.(str)
print(f"number's type : {type(number)}")
# 문자열을 정수로 변환
... |
df751c1729fbf8c9b16e559fd65b8bd0d5ff237d | yongseongCho/python_201911 | /day_11/exception_07.py | 1,388 | 3.90625 | 4 | # -*- coding: utf-8 -*-
class Calculator :
def __init__(self) :
# 아래의 코드는 숫자가 입력되지 않는 경우
# 예외가 발생합니다.
# 예외처리를 활용하여 숫자가 들어올때까지
# 값을 입력받도록 수정하세요.
while True :
self.n1 = input('첫번째 정수 : ')
try :
self.n1 = int(self.n1)
... |
75cdeb7a52fe1fdee3dbffb6670885373405fce8 | yongseongCho/python_201911 | /day_17/matplotlib_09.py | 734 | 3.5625 | 4 | # -*- coding: utf-8 -*-
from matplotlib import pyplot as plt
x1 = list(range(1, 101))
y1 = list(map(lambda x : x * 1.2, x1))
x2 = list(range(1, 101))
y2 = list(map(lambda x : x * 1.7, x2))
plt.title('matplotlib example')
plt.xlabel('x label')
plt.ylabel('y label')
# 여러 라인을 하나의 그래프에 출력하는 경우
# 각 라인을 구... |
223a2acb37abfe44d49fd6a11f62f23e1cd224da | yongseongCho/python_201911 | /day_17/matplotlib_11.py | 508 | 3.828125 | 4 | # -*- coding: utf-8 -*-
# 각 구구단의 결과를 서브플롯을 사용하여
# 출력하는 예제
from matplotlib import pyplot as plt
x = list(range(1,10))
y = []
for dan in range(2, 10) :
y.append([])
for mul in range(1, 10) :
y[-1].append(dan*mul)
plt.title('GuGuDan Chart!')
for i, data in enumerate(y) :
plt.s... |
43d5dce8abcbe7004d305a1a25ea59152ccdd6d5 | yongseongCho/python_201911 | /day_03/list_01.py | 2,117 | 3.75 | 4 | # -*- coding: utf-8 -*-
# LIST 타입의 변수 사용
# 기존의 배열과 유사한 타입의 변수 (동적 배열)
# - 배열의 정의
# - 동일한 타입의 연속된 집합
# 비어있는 리스트 변수의 선언
list_1 = []
# 3개의 정수 요소를 가지는 리스트의 선언
list_2 = [10, 20, 30]
# 다양한 타입의 요소를 가지는 리스트 선언
# - 배열과의 차이점!
list_3 = [10, 11.5, 'Python_List', True]
print(list_1)
print(list_2)
print(list_3)
... |
5182e61a1fbf2b9a45709e8a7f6d5f781a6b0967 | yongseongCho/python_201911 | /day_10/class_12.py | 947 | 3.703125 | 4 | # -*- coding: utf-8 -*-
# 구구단 클래스를 작성하세요.
# 구구단 클래스에는 두개의 메소드를 포함합니다.
# printAll 메소드와 printOne 메소드
# printAll 메소드는 매개변수가 없으며, 호출되면
# 전체 구구단을 출력
# printOne 메소드는 하나의 정수형 매개변수가
# 있으며, 호출되면 전달된 매개변수의 구구단 출력
class GuGuDan :
def printAll(self) :
print('printAll 메소드 실행')
for dan in ra... |
f503a76cf01ef51bc080e7b543fc1ed792585945 | yongseongCho/python_201911 | /day_10/class_10.py | 2,234 | 3.5625 | 4 | # -*- coding: utf-8 -*-
class Animal :
def __init__(self, name, age, color) :
self.name = name
self.age = age
self.color = color
def showInfo(self) :
print(f'name : {self.name}')
print(f'age : {self.age}')
print(f'color : {self.color}')
# 생성자 재정의... |
3209947bf5e2e8f33dd65561744ecc8380faf4ab | aziaziazi/Euler | /problem 2.py | 235 | 3.765625 | 4 | def sum_fibonacci_not_even():
fib = [1,1]
total = 0
while fib[-1]<4000000:
to_add = fib[-1]+fib[-2]
fib.append(to_add)
if not fib[-1] % 2:
total+=to_add
fib[-1] = 0
print fib
return total
print sum_fibonacci_not_even()w |
7dce36f488376f1961ce6a822b3eda6885291e9f | faeze20/python_examples | /Level3_Examples/all_files_and_directories.py | 202 | 3.78125 | 4 | # list all files and directories
import os
def list_dir(directory):
a = os.listdir(directory)
for i, item in enumerate(a): # All files
print(i, ': ', item)
list_dir(current_dir)
|
44b220ae1398959dfb28f17c78eb558db4c59387 | qtdwzAdam/leet_code | /py/back/work_529.py | 2,137 | 3.5625 | 4 | class Solution(object):
lenx = 0
leny = 0
def set_val(self, board, point, val):
try:
board[point[0]][point[1]] = val
except:
board[point[0]] = board[point[0]][:point[1]] + str(val) + board[point[0]][point[1]+1:]
def updateBoard(self, board, click):
"""
... |
25fb291063dade9bb682e0657107aee6c37b07c6 | qtdwzAdam/leet_code | /py/202211/61.旋转链表.py | 1,541 | 3.65625 | 4 | #
# @lc app=leetcode.cn id=61 lang=python
#
# [61] 旋转链表
#
# @lc code=start
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def rotateRight(self, head, k):
"""
:type... |
b0105281f59f1073588379fd1897e0bab3b49e53 | qtdwzAdam/leet_code | /py/202211/445.py | 1,691 | 3.96875 | 4 | """
You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Fo... |
975bc50899cf75c023d9d505946ee915c19f3ccd | qtdwzAdam/leet_code | /py/back/work_721.py | 765 | 3.515625 | 4 | from pprint import pprint
class Solution(object):
def accountsMerge(self, accounts):
"""
:type accounts: List[List[str]]
:rtype: List[List[str]]
"""
val = sorted(accounts, key=lambda x: x[0])
output = [val[0]]
for x in val[1:]:
flag_match = False
... |
5ac31df1a7457d4431e7c8fbdc1892bf02d393d0 | qtdwzAdam/leet_code | /py/back/work_405.py | 1,282 | 4.53125 | 5 | # -*- coding: utf-8 -*-
#########################################################################
# Author : Adam
# Email : zju_duwangze@163.com
# File Name : work_405.py
# Created on : 2019-08-30 15:26:20
# Last Modified : 2019-08-30 15:29:47
# Description :
# Given an integer, write an algori... |
af6c0853be598ba91d3f49818be9de56458064e8 | qtdwzAdam/leet_code | /py/202211/143.重排链表.py | 1,337 | 3.84375 | 4 | #
# @lc app=leetcode.cn id=143 lang=python
#
# [143] 重排链表
#
# @lc code=start
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def reorderList(self, head):
"""
:type ... |
317dc1d9bd27a116e57e4ce4ca061b379801bae6 | qtdwzAdam/leet_code | /py/202211/421.py | 1,399 | 3.5 | 4 | # coding=utf-8
"""
Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231.
Find the maximum result of ai XOR aj, where 0 ≤ i, j < n.
Could you do this in O(n) runtime?
Example:
Input: [3, 10, 5, 25, 2, 8]
Output: 28
Explanation: The maximum result is 5 ^ 25 = 28.
"""
class Solution(object)... |
84c61b1c48b90fee9cd509092a85cd8dff23de00 | ojffjo/hello | /games.py | 1,668 | 4 | 4 | # Guessing Game
# win_num = 7
# guess_count = 1
# guess_limit = 3
# while guess_count <= guess_limit:
# guess_num = int(input("Guess: "))
# if guess_num == win_num:
# print('You won!')
# break
# if guess_count < 3:
# print("Try again!")
# guess_count += 1
# else:
# print('Sor... |
4db43a5be07d760c4feb1346c74d3bc80228880c | vc2309/interview_prep | /data_structures/string_compression.py | 376 | 3.859375 | 4 | def compress(a):
ln = len(a)
if not ln:
return
char = a[0]
count = 1
compressed = char
for i in range(1,ln):
if char!=a[i]:
compressed+=str(count)
count=1
char=a[i]
compressed+=char
else:
count+=1
compressed+=str(count)
return compressed
def main():
word = raw_input("Enter string \n")
p... |
2ea19e7b023b6945d34d2a164a5bd668ff5aefb6 | vc2309/interview_prep | /dp/steps.py | 458 | 3.90625 | 4 | def steps(steps_left, steps_counts,hashmap):
if steps_left==0:
return 1
elif steps_left<0:
return 0
if not hashmap.get(steps_left):
hashmap[steps_left]=0
for i in steps_counts:
if i<=steps_left:
hashmap[steps_left]+=steps(steps_left-i,steps_counts,hashmap)
return hashmap[steps_left]
def main():
ste... |
4b47cd1d45c5a4a1a5587b8f14d48b896eab145b | vc2309/interview_prep | /dp/knapsack.py | 515 | 3.796875 | 4 | def knapsack(W, weights, values):
K={w:v for w,v in zip(weights,values)}
for i in range(W+1):
max_weight=0
for j,wi in enumerate(weights):
if wi <=i:
rem_val=K.get(i-wi) if K.get(i-wi) else 0
max_weight=max(rem_val+wi,rem_val)
K[i]=max_weight
return K[W]
def main():
weights=[2,2,3,4]
values=[10,4... |
4b3ce42dde5e951efe9620bfce24c01f380715e7 | gauravtatke/codetinkering | /leetcode/LC110_balanced_bintree.py | 2,087 | 4.3125 | 4 | # 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 depth of the two subtrees of every node never differ by more than 1.
# Example 1:
# Given the following tree [3,9,20,null,null,15,7]:
# 3
# / \
# 9 20
... |
b58fc479c49beea872b3e36ad186884341a00d28 | gauravtatke/codetinkering | /leetcode/LC72_edit_distance.py | 3,594 | 3.859375 | 4 | # Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)
#
# You have the following 3 operations permitted on a word:
#
# a) Insert a character
# b) Delete a character
# c) Replace a character
class Solution1(object):
# this is... |
c28bff4e76406f1c4742988db3b90ddcf792bc65 | gauravtatke/codetinkering | /leetcode/singlenumber.py | 611 | 3.8125 | 4 | #!/usr/bin/env python3
# Given an array of integers, every element appears twice except for one. Find
# that single one.
#
# Note:
# Your algorithm should have a linear runtime complexity. Could you implement it
# without using extra memory?
def singleNumber(nums):
nu = 0
for n in nums:
nu = nu ^ n
... |
32a89094e2c55e2a5b13cf4a52a1cf6ef7206894 | gauravtatke/codetinkering | /leetcode/LC98_validate_BST.py | 798 | 4.21875 | 4 | # Given a binary tree, determine if it is a valid binary search tree (BST).
#
# Assume a BST is defined as follows:
#
# The left subtree of a node contains only nodes with keys less than the node's key.
# The right subtree of a node contains only nodes with keys greater than the node's key.
# Both the left ... |
996e3858f7eb3c4a8de569db426c2f9cdd5fd71a | gauravtatke/codetinkering | /dsnalgo/firstnonrepeatcharinstring.py | 1,292 | 4.15625 | 4 | #!/usr/bin/env python3
# Given a string, find the first non-repeating character in it. For
# example, if the input string is “GeeksforGeeks”, then output should be
# ‘f’ and if input string is “GeeksQuiz”, then output should be ‘G’.
def findNonRepeatChar(stri):
chlist = [0 for ch in range(256)]
for ch in str... |
f0e6eaf2e6f2d0eb0b1cc41b04bee13afdda08ef | gauravtatke/codetinkering | /dsnalgo/matrixchain.py | 2,582 | 3.5 | 4 | #!/usr/bin/env python3
'''
Matrix chain = <A1 A2 A3 .... Ai .... An>
Each Ai matrix has dimension = Pi-1 X Pi
So index chain = <P0 P1 P2...Pi-1 Pi....Pn>
cost[i, j] = array cost[1..n-1, 1..n-1], cost of multiplying Ai to Aj
sol[i, j] = array sol[1..n-1, 2...n] is array where value of 'K' is stored. K
is index where to... |
c106671082f8f393f73ebad1a355929e142cfdc6 | gauravtatke/codetinkering | /leetcode/LC345_reverse_vowelsof_string.py | 739 | 4.28125 | 4 | # Write a function that takes a string as input and reverse only the vowels of a string.
#
# Example 1:
# Given s = "hello", return "holle".
#
# Example 2:
# Given s = "leetcode", return "leotcede".
#
# Note:
# The vowels does not include the letter "y".
def reverseVowels(s):
lstr = list(s)
i = 0
j = len(... |
67deb25bab0acaf56f9cd127c47627afda9b8f11 | gauravtatke/codetinkering | /leetcode/LC456_pattern321.py | 1,928 | 3.84375 | 4 | # Given a sequence of n integers a1, a2, ..., an, a 132 pattern is a subsequence ai, aj, ak such that i < j < k and ai < ak < aj.
# Design an algorithm that takes a list of n numbers as input and checks whether there is a 132 pattern in the list.
# Note: n will be less than 15,000.
# Example 1:
# Input: [1, 2, 3, 4]
#... |
0d37f87ebde2412443f7fefbf53705ac0f03b019 | gauravtatke/codetinkering | /dsnalgo/lengthoflongestpalindrome.py | 2,308 | 4.1875 | 4 | #!/usr/bin/env python3
# Given a linked list, the task is to complete the function maxPalindrome which
# returns an integer denoting the length of the longest palindrome list that
# exist in the given linked list.
#
# Examples:
#
# Input : List = 2->3->7->3->2->12->24
# Output : 5
# The longest palindrome list is 2-... |
24d9612dd09f954cad68397e915827d60daedc91 | gauravtatke/codetinkering | /dsnalgo/Inversion.py | 2,160 | 3.59375 | 4 | def find_inversion_brute(numlist, beg, end):
#This counts inversion and also stores indices where it occurs.
#This is brute force and solves all problem space
i = beg-1
count = 0
inver_indice = []
for index1, elem1 in enumerate(numlist[beg:end+1], start=beg):
i = i+1
for ... |
8d9bb6926f1bd85ef8da53778229913d6ac4bc86 | gauravtatke/codetinkering | /dsnalgo/sort_pile_of_cards.py | 1,047 | 4.125 | 4 | #!/usr/bin/env python3
# We have N cards with each card numbered from 1 to N. All cards are randomly shuffled. We are allowed only operation moveCard(n) which moves the card with value n to the top of the pile. You are required to find out the minimum number of moveCard() operations required to sort the cards in incre... |
8eb6703ee0ed6b69c41c76997764704beca2b6cb | gauravtatke/codetinkering | /leetcode/LC13_roman_to_int.py | 792 | 3.515625 | 4 | from __future__ import annotations
roman_dict = {
'I': 1,
'V': 5,
'X': 10,
'L': 50,
'C': 100,
'D': 500,
'M': 1000
}
class Solution:
def romanToInt(self, s: str) -> int:
result_int = 0
prev = None
for curr in s[-1::-1]:
... |
0a8c8f7a39093295d7a28db592033996006ad7a8 | gauravtatke/codetinkering | /leetcode/LC26_remove_duplicates_sorted_array.py | 1,576 | 3.84375 | 4 | #Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.
#
#Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
#
#Example 1:
#
#Given nums = [1,1,2],
#
#Your function should re... |
a783b4053b012143e18b6a8bd4335a8b84b5d031 | gauravtatke/codetinkering | /leetcode/LC433_min_gene_mut.py | 2,495 | 4.15625 | 4 | # A gene string can be represented by an 8-character long string, with choices from "A", "C", "G", "T".
# Suppose we need to investigate about a mutation (mutation from "start" to "end"), where ONE mutation is defined as ONE single character changed in the gene string.
# For example, "AACCGGTT" -> "AACCGGTA" is 1 mutat... |
a673b6f976960ce66dbaa76ccefeb71d0f423ca1 | gauravtatke/codetinkering | /leetcode/LC141_linked_list_cycle.py | 2,520 | 4.09375 | 4 | #Given a linked list, determine if it has a cycle in it.
#
#To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail connects to. If pos is -1, then there is no cycle in the linked list.
#
#Example 1:
#
#Input: head = [3,2,0,-4], pos = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.