Ad
  • Default User Avatar

    Really bruh??. This is the worst for the given scenario. Think about the time and space complexity. A single line of code will give the required output. This isn't to critisize you but to encourage you. Please do learn the basics of algorithms