Hot answers tagged

4 votes
Accepted

Stuck on PSet1: I have the correct output, but Check50 output says it's wrong

edited question From the spec: Take care to left-align the bottom-left corner of the left-hand half-pyramid with the left-hand edge of your terminal window. In other words, the last line must ...
user avatar
4 votes
Accepted

string comparison & crack.c

If you read the man page of the crypt function it says in one point: The return value points to static data whose content is overwritten by each call. So the first time you ...
user avatar
  • 7,326
3 votes
Accepted

where is the hacker version

No, the hacker edition is available for everyone doing the course, though, those of us taking it through edx cannot submit the work done under the Hacker Edition for credit, we still can do it. If ...
user avatar
  • 1,170
2 votes

Hacker edition problems

The hacker edition problems have now become the "more comfortable" problems in a problem set. For example, in pset1, mario (less comfortable) involves printing one pyramid, while mario (more ...
user avatar
  • 184
2 votes
Accepted

Can i submit a hacker pset?

No!hacker pset is only for personal practice and not for uploading or credit.
user avatar
1 vote

Does working on the Hacker Edition problem sets affect the certificate?

You must do the standard problem sets to get a certificate; Hacker Edition problem sets are completely optional and have no effect on grading or certificates in edX. The CS50x 2014 syllabus covers ...
user avatar
  • 2,146
1 vote

where is the hacker version

The Hacker version is listed on the same page as the Standard version. For example, for Problem Set 1: Courseware Page for problem set 1 Notice there are 2 headings, Standard and Hacker, and an ...
user avatar
  • 18.3k
1 vote

How can I add alternate digits in credit.c?

First, char is NOT int. I mean if you have string s = "1234"; and then you wrote something like int sum = 0; // iterate over s and sum the chars up for (int i = 0, n = strlen(s); i < n; i++) { ...
user avatar
  • 17.4k
1 vote

Always having the same randomized game of fifteen

In the GNU C library, RAND_MAX, the default maximum return value of rand() is the largest signed integer value. And so, sometimes, if the rand() returns a high enough value and you multiply it by "i", ...
user avatar
1 vote
Accepted

Always having the same randomized game of fifteen

Like most soi-disant "random" functions, rand() isn't really random. It generates pseudorandom numbers using a deterministic algorithm. This algorithm will always produce the same results if it is "...
user avatar
  • 3,035
1 vote

Issue when randomizing tiles of the game of fifteen with Fisher-Yates algorithm

The problem lies here: int j = rand() * i; The call to rand() returns a very large number. From there on, it just gets propogated through the code, used in other calculations, and pushed further ...
user avatar
  • 63.1k
1 vote

"Bad Credit" segmentation fault issue

I'd suggest a different method of turning your long long into an array: (1) Declare a char array with char s[20]; (20 digits should be enough for a long long), (2) Use sprintf to pass num into char ...
user avatar
1 vote
Accepted

pset2 hacker - initials.c outputs "MB" for " milo banana " expected output, but not "MB\u0000\n"

Interesting. I ran your code and it passed check50. I was unable to duplicate the problem. However, I do see the issue. You were on the right track, but your attempts to correct had errors. The ...
user avatar
  • 63.1k
1 vote

What is wrong with my hacker mario.c code for pset1?

I would pick small numbers for h (e.g., 1 and 2), determine what the expected results should look like and follow the logic of my code using a pencil and a paper. for example, when h == 1, I should ...
user avatar
  • 17.4k
1 vote
Accepted

pset1 credit: segmentation error

Classic error. The function isdigit() takes a single character as input. You are attempting to feed it an entire string, so it chokes, causing a seg fault. If you want to verify that every character ...
user avatar
  • 63.1k

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