Skip to content

Instantly share code, notes, and snippets.

View Pierian-Data's full-sized avatar

Pierian Data Pierian-Data

View GitHub Profile
def large_cont_sum(arr):
# Check to see if array is length 0
if len(arr)==0:
return 0
# Start the max and current sum at the first element
max_sum=current_sum=arr[0]
# For every element in array
def compress(s):
run = ""
length = len(s)
if length == 0:
return ""
# "A" --> "A1"
if length == 1:
def profit(stock_prices):
if len(stock_prices) < 2:
return "Hey I need more prices!"
min_stock_price = stock_prices[0]
max_profit = 0
for price in stock_prices:
def finder(arr1,arr2):
arr1.sort()
arr2.sort()
for num1,num2 in zip(arr1,arr2):
if num1 != num2:
return num1
def myfunc():
print('Hello World')
def myfunc(name):
#return 'Hello {}'.format(name)
print('Hello {}'.format(name))
def myfunc(x):
if x == True:
# print('Hello')
return 'Hello'
elif x == False:
# print('Goodbye')
return 'Goodbye'
def myfunc(x,y,z):
if z:
# print(x)
return x
else:
# print(y)
return y
def myfunc(a,b):
print(a+b)
# return a+b
def is_even(n):
if n%2 == 0:
return True
# print(True) **tested to make sure it DOESN'T work
else:
return False