Create New Version
Learn this problemProblem statement
Create a new version of the given string by following the given rules.
Note
The digits in the input string can be negative, in which case you will append the current output string once to the output. If you encounter 0 or 1, do not append anything to the current output.
𓈒ㅤׂㅤ𓇼 ࣪ 𓈒ㅤׂㅤCredit to Charlotte⭒ 𓆡 ⭒ㅤ𓈒ㅤׂ 🫧
Function
createNewVersion(s: String) → StringExamples
Example 1
s = "cisco"return = "cisco"The given string is "cisco" and contains all letters so add it to the output string (using rule number 1). So, the output will be "cisco".
Example 2
s = "cisco2india"return = "ciscociscoindia"The given string is "cisco2india" which contains one digit '2' after "cisco" so by using rule number 2, we get "ciscocisco" and the remaining substring "india" it is added to the output string using rule number 1. So, the output is "ciscociscoindia".
Constraints
🍅🍅More Cisco problems
- Collect CoinsSeen Jun 2025
- FizzBuzz ProblemSeen May 2025
- Find Largest Sum Contiguous SubarraySeen May 2025
- Find Largest Sum of Continuous SequenceSeen May 2025
- Find Palindrome Sub-stringSeen May 2025
- Count Numbers with Digit SumSeen Mar 2025
- Maximum Chocolates from Jars (L.C. 198 :)Seen Mar 2025
- Find Elements Largest in Row Smallest in ColumnSeen Mar 2025