Special Sum of Array You have been given an array/list ‘arr’ of length ‘N’, which contains single digit elements at every index. Your task is to return the sum of all elements of the array. But the final sum should also be a single digit. To keep the output single digit - you need to keep adding the digits of the outpu...

read more
CodingNinjas
author
2y

The brute force problem will lead to overflow and hence all test cases will not pass.
So, we had to give the most optimized solution 

CodingNinjas
author
2y
Brute ForceWe will iterate from left to right and will calculate the sum of the elements and if the sum becomes a double-digit number we will make it a single-digit number according to the steps given...
see more
Add answer anonymously...
Bajaj Finserv Data Scientist Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
55 L+

Reviews

5 L+

Interviews

2 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2023 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Hello, Guest
Contribute to help millions!
Write a review
Share interview
Contribute salary
Add office photos
Add office benefits