News for hackers. Stuff that matters.
Re:Stop Eliminating Perfectly Good Candidates by Asking Them... by harshalizee on Saturday June 03, 2023 @12:06PM (#36177781)
Looks like I'd fail your pre-screen test. What's the "mathematical" solution if you're not allowed to convert strings to ints? Ascii math?
Re:Stop Eliminating Perfectly Good Candidates by Asking Them... by monkeyjoe on Saturday June 03, 2023 @12:25PM (#36177969)
I think it just means taking the input as an integer and then separating out the “ones place”and “tens place” using integer division and modulo operator. E.g.,

  ones = number % 10

  tens = number // 10

  do_print = (ones + tens) == 10
Re:Stop Eliminating Perfectly Good Candidates by Asking Them... by harshalizee on Saturday June 03, 2023 @12:39PM (#36178118)
That's what my solution after the parsing would be.

OP mentioned reading from a file, which you would only be able to use after string conversion to ints.

Re:Stop Eliminating Perfectly Good Candidates by Asking Them... by ProZsolt on Saturday June 03, 2023 @02:26PM (#36179197)
Maybe they didin't calculated the digits, like this:

if toInt(number) % 10 != 0

  print number  
else

  print number + "(" + number[0] + "," + number[1] + ")"
Re:Stop Eliminating Perfectly Good Candidates by Asking Them... by hahamrfunnyguy on Tuesday June 06, 2023 @09:32AM (#36212441)
Yes. This is the mathematical solution.
Re:Stop Eliminating Perfectly Good Candidates by Asking Them... by m3047 on Saturday June 03, 2023 @01:03PM (#36178349)
Not quite sure, and I'm not quite sure I care either. ;-)

However for any multiple of 9, the digits will add up to a multiple of 9. So you're looking for numbers in [ (n+2)*9 + 1 for n in range(9) ]

Re:Stop Eliminating Perfectly Good Candidates by Asking Them... by tomjupiter on Saturday June 03, 2023 @04:59PM (#36180468)
I think hahamrfunnyguy must have meant "convert the numbers to strings" - that's the only way I can make sense of it. quiz.txt must contain code, not sample data.
Re:Stop Eliminating Perfectly Good Candidates by Asking Them... by hahamrfunnyguy on Tuesday June 06, 2023 @09:29AM (#36212402)
Yes, quiz.txt was the start of a C# program with a main method and a function that was called to do the work asked.

The common string based solution was to use a for loop, convert the counter to a string, parse the digits converting each one to a an integer and performing the calculation.

The exercise was given in C# so candidates just use string interpolation to output the result