File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "python.pythonPath" : " /usr/bin/python3"
3
+ }
Original file line number Diff line number Diff line change 1
1
'''
2
2
The stock span problem is a financial problem where we have a series of n daily
3
- price quotes for a stock and we need to calculate span of stock’ s price for all n days.
3
+ price quotes for a stock and we need to calculate span of stock' s price for all n days.
4
4
5
- The span Si of the stock’ s price on a given day i is defined as the maximum
5
+ The span Si of the stock' s price on a given day i is defined as the maximum
6
6
number of consecutive days just before the given day, for which the price of the stock
7
7
on the current day is less than or equal to its price on the given day.
8
8
'''
9
+ from __future__ import print_function
9
10
def calculateSpan (price , S ):
10
11
11
12
n = len (price )
@@ -37,7 +38,7 @@ def calculateSpan(price, S):
37
38
# A utility function to print elements of array
38
39
def printArray (arr , n ):
39
40
for i in range (0 ,n ):
40
- print arr [i ],
41
+ print ( arr [i ],end = " " )
41
42
42
43
43
44
# Driver program to test above function
@@ -48,4 +49,4 @@ def printArray(arr, n):
48
49
calculateSpan (price , S )
49
50
50
51
# Print the calculated span values
51
- printArray (S , len (price ))
52
+ printArray (S , len (price ))
You can’t perform that action at this time.
0 commit comments