This repo contains a script which was developed for solving a HackerRank problem. The problem was the following:
For any given array of Stock prices StockPrices
of size n (0 < n < 1000000)
.
StockPrices[i]
is an integer representing stock price on day i
. where 0 < i < n
and 0 < StockPrices[i] < 1000000
.
For an array of days Days
of size m (0 < m < n)
. Days[j]
is an integer representing a day to be queried where j (0 < j < m)
. Find the nearest day X
from StockPrices
where StockPrices[X] < StocPrices[Days[j]]
working on generalizing this scritp by implementing it as a library for finding the nearest smaller number.