We changed our privacy policy. Read more.

Hot answers tagged

4

Found it: American Express starts with 34 or 37, Master Card starts with 51, 52, 53, 54 or 55. This makes those two numbers INVALID despite good checksum :)


3

You MUST be in the same directory as the source code to run check50 and submit50. It doesn't work if you're not. The parameter isn't about where the code is located, it's about which tests to run. If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)


3

I guess you meant print(dna[i:i+len("AGATC")]). In Python, if the end of the substring is before the beginning, the substring is empty, so you are printing a bunch of empty strings.


2

1) Because I can't modify the header, how can I use strcmp (hints ask for) without string.h ? You can include string.h as per the spec: (and the inclusion of additional header files, if you’d like). (and yes, it looks like plurality.c is a typo and should read runoff.c) You cannot change to this for (int j = 0; j < 3; j++) // each voters can vote 3 ...


1

Ok, I`ve found the bug. It came out, that my code wasn't comparing the current sequnce lenth with the previous maximum, but just increased 'counter' value, if the STR lenth was greater than 1. It meant that in case I had two seqences 2 and 3 STR long, my result would'n be '3' but '5'. A minor change in code and one more variable did the job!


1

The file name would likely be a typo :) It's ok to add header includes to runoff.c. I guess that sentence got refactored a bit, and the part in parentheses should be moved to the where-to-change part to be less confusing. Each voter has candidate_count votes, for the example of three candidates, that's three votes. It's the order that matters. ...


Only top voted, non community-wiki answers of a minimum length are eligible