3461. Check If Digits Are Equal in String After Operations I
Easy
10 Points
Math
String
Simulation
Combinatorics
Number Theory
You are given a string s consisting of digits. Perform the following operation repeatedly until the string has exactly two digits:
Return true if the final two digits in s are the same; otherwise, return false.
Examples
Example 1
Input: s = "3902"
Output: true
Explanation:
Example 2
Input: s = "34789"
Output: false
Explanation:
Constraints
3 <= s.length <= 100
s consists of only digits.
3461. Check If Digits Are Equal in String After Operations I
Easy
10 Points
Math
String
Simulation
Combinatorics
Number Theory
You are given a string s consisting of digits. Perform the following operation repeatedly until the string has exactly two digits:
Return true if the final two digits in s are the same; otherwise, return false.
Examples
Example 1
Input: s = "3902"
Output: true
Explanation:
Example 2
Input: s = "34789"
Output: false
Explanation:
Constraints
3 <= s.length <= 100
s consists of only digits.
Check If Digits Are Equal in String After Operations I - Practice Coding | SlaveCode