Not able to pass the test case correctly - C#