My some test cases are not passing ,for example it cannot pass the sample input case there is one garbage value is coming,please check my code and do the corrections.
If array length not equal one garbage value is coming
Hey @aatmictiwari19
Updated your code and mentioned the changes in comments: https://ide.codingblocks.com/s/360532 
If this resolves your query then please mark it as resolved 