7 kyu

BAD Hash - String to Int

108 of 259Bigg-T
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • dbtx Avatar

    Give an example of ${thing}

    is not a question.

  • oldcoder Avatar

    thanks for kata.that was good.

  • akar-0 Avatar

    Steps c and d are clearly the most difficult in the task ((NOT a) shift left by 2 bits)), I think the examples should give the expected value for c, not just for a and b.

    b := sum of every difference between the consecutive characters of the input : Does it mean "sum of difference of ascii values"?

  • SunMaster Avatar

    Using C.

    The description is incorrect/misleading. It states "b := sum of every difference between the consecutive characters of the input" The difference between two numbers is always a positive value. This kata requires you to take the higher index and subtract the lower index, e.g. str[1] - str[0], str[2] - str[1] and so forth. abs(str[1] - str[2]) will give you the difference between two numbers, but is incorrect here.

    • fenring76 Avatar

      I agree that the kata is misleading in step (b).

      The difference between two numbers is always a positive value.

      This is incorrect. A difference is the result of subtracting one number from another number. In the equation 5 - 7 = -2, -2 is the difference.

      But you're right: Step (b) should specify the direction of the subtraction operation.

    • FArekkusu Avatar
      Issue marked resolved by FArekkusu 5 years ago
  • FArekkusu Avatar

    Python translation. Please, review and approve (the author is not active anymore).

  • FArekkusu Avatar

    C version needs random tests.

  • uniapi Avatar

    Please, NASM Translation

  • siebenschlaefer Avatar

    Suggestions:

    • Write "spaces" instead of "white spaces" because there are several characters that are considered white space (see isspace(3)).
    • Instead of "(NOT a then shift left by 2 bits)" write "((NOT a) shift left by 2 bits)".
    • "consecutive" instead of "consective"