Description
Solutions
Valid String Check

Given a string, check if it is valid (return 1 :) or not (return 0 :). A valid string must:

  • Be divisible by 3 (interpreted as the numeric value of the string is divisible by 3).
  • Contain the digit '7' at least twice.
  • Example 1:

    Input:  s = "771"
    Output: 1
    Explanation:
    :)

    Example 2:

    Input:  s = "777"
    Output: 1
    Explanation:
    :)

    Example 3:

    Input:  s = "123777"
    Output: 1
    Explanation:
    :)

    Example 4:

    Input:  s = "12345"
    Output: 0
    Explanation:
    :)

    Example 5:

    Input:  s = "71"
    Output: 0
    Explanation:
    :)

    Example 6:

    Input:  s = "171"
    Output: 0
    Explanation:
    :)

    Example 7:

    Input:  s = "70"
    Output: 0
    Explanation:
    :)
    Constraints:
      :)
    Thumbnail 0
    Testcase

    Result
    Case 1

    input:

    output: