Ad
  • Custom User Avatar

    Lol it only made sense to me after I read your explanation. Thank you!

  • Custom User Avatar

    This problem statement is not great.

    The table and column names should be clear and consistently formatted.

    Table name: people
    Column names:
    id (PK int),
    age (int),
    otherdata (datatype),
    ...

    Formatting is not very thorough in these problems.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    The most offensive line is "Count the number of digits d used in the writing of all the k**2"

    Very unclear.

    It should be written as "Count the number of occurrences of digit d in all squared values between 0 and n inclusive"

    Also, the phrase "Note that 121 has twice the digit 1"

    Is a little off, and should be written "Note that 1 appears twice in 121"

    Is it necessary to write "Square all numbers k (0 <= k <= n) between 0 and n"

    when "Square all numbers between 0 and n inclusive" would suffice?

    Specifying that digits fall between the range of 0 and 9 inclusive is redundant; using a base 10 digit system is implied.

    Revised Problem Description:

    Return the number of occurrences of digit 'd' in the set of squared numbers between 0 and n inclusive

    Constraints:
    (0 <= n <= 1_000_000)
    # NOTE: The problem theoretically includes infinitely large numbers. There should be a constraint for n other than n >= 0. Also, neither k nor d need to be specified as a range.

    Revised Examples:

    Example 1:
    n = 10
    
    d = 1
    
    The squared numbers between 0 and n inclusive are 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100
    
    We are counting the number of occurrences of the digit 'd' in the squared numbers.
    
    There are 4 instances of '1' in the squared numbers, so the answer is 4.
    
    
    Example 2:
    n = 25
    
    d = 7
    
    The numbers between 0 and 25 squared are: (list all the numbers between 0 and 25 squared)
    
    There are {number of occurrences} of the digit 7 in the list of squared numbers, so the answer is {number of occurrences}
    
  • Custom User Avatar
  • Custom User Avatar

    Please use spoiler flag next time.

  • Custom User Avatar
    • which examples do you suggest adding, and why?
    • what suggestions do you have that would make it more clear?
  • Custom User Avatar

    Seconding what everyone else said, this description is confusing and unhelpful, especially for a 7-kyu problem. Provide more examples and make it more clear, please.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Variable names evoke sadness

  • Custom User Avatar

    Clever, but not efficient. Nit: should space around operators by default to improve readability.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Loading more items...