added boundry check for negative steps
implemented bottom up dp solution