Given a string, check if it is valid (return 1 :) or not (return 0 :). A valid string must:
Examples
01 · Example 1
s = "771" return = 1
:)
02 · Example 2
s = "777" return = 1
:)
03 · Example 3
s = "123777" return = 1
:)
04 · Example 4
s = "12345" return = 0
:)
05 · Example 5
s = "71" return = 0
:)
06 · Example 6
s = "171" return = 0
:)
07 · Example 7
s = "70" return = 0
:)
More Uber problems
- Total Palindrome Substring CostOA · Seen Jun 2026
- Earliest Time All Users Are ConnectedPHONE SCREEN · Seen May 2026
- Tournament Rounds by RankPHONE SCREEN · Seen May 2026
- Farthest Seat AssignmentONSITE INTERVIEW · Seen May 2026
- Convex Function MinimizationPHONE SCREEN · Seen May 2026
- Maximal Square AreaONSITE INTERVIEW · Seen May 2026
- First Unique IP Hitting the ServerPHONE SCREEN · Seen May 2026
- Jump Game with Prime-Step RuleOA · Seen May 2026
public int isValidString(String s) {
// write your code here
}
s"771"
expected1
sign in to submit