• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
December 05, 2023 |2.4K Views
PROBLEM OF THE DAY : 04/12/2023 | Sum-string
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Devashish Khare. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Strings but also build up problem-solving skills.

In this problem, we are given, a string of digits, the task is to check if it is a ‘sum-string’. A string S is called a sum-string when it is broken down into more than one substring and the rightmost substring can be written as a sum of two substrings before it and the same is recursively true for substrings before it.

Example :

Input:
S = "12243660"
Output:
1

Explanation:
"12243660" can be broken down as {"12", "24", "36", "60"}. We can get 60 from 24 and 36 as 24 + 36 = 60. Similarly 36 can be written as 12 + 24.

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/sum-string3151/1