#MLHR-726 #comment Fixed a bug related to time interval. Also used dynamic programming approach with cache to improve performance.