Merge pull request #407 from s-sanyal/master

Made the code Python 3 compatible
This commit is contained in:
Harshil 2018-10-04 11:37:12 +02:00 committed by GitHub
commit c8e7a65475
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"python.pythonPath": "/usr/bin/python3"
}

View File

@ -1,11 +1,12 @@
'''
The stock span problem is a financial problem where we have a series of n daily
price quotes for a stock and we need to calculate span of stocks price for all n days.
price quotes for a stock and we need to calculate span of stock's price for all n days.
The span Si of the stocks price on a given day i is defined as the maximum
The span Si of the stock's price on a given day i is defined as the maximum
number of consecutive days just before the given day, for which the price of the stock
on the current day is less than or equal to its price on the given day.
'''
from __future__ import print_function
def calculateSpan(price, S):
n = len(price)
@ -37,7 +38,7 @@ def calculateSpan(price, S):
# A utility function to print elements of array
def printArray(arr, n):
for i in range(0,n):
print arr[i],
print (arr[i],end =" ")
# Driver program to test above function