Ad
  • Custom User Avatar

    Happend to me as well, because I forgot to include - 0^2 - , so my counter did not count the first 0.
    Also make sure to count the upper-bound - n^2.

  • Default User Avatar

    Thanks a lot, I'm new to Python and don't have quite the logic and syntax in mind yet, so pocket tutorials like this are a big help

  • Default User Avatar

    I have the "5750, 0 -> Expected 4700, got 4699" issue, but the other test work fine.
    Would someone have a clue to share on why or how ?
    Edit : Occurs in Python

  • Default User Avatar

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

  • Default User Avatar

    Rather than checking for None each time you loop, wouldn't it be better to check if lst has a first element in lst[0] and put this value in both l and u on their declaration ?

  • Default User Avatar

    Your program shouldn't break if it receive an invalid (here, null) argument, so you should have some checks for such case before doing anything

  • Default User Avatar

    It's a difficult question. What you need to learn depends on challenges you will face during the trial, your background in computer science, and programming skills. I don't know anything about that.

    It would be fine to address this question to the supervisor/manager/administrator/etc. of your preliminary trial. If it isn't possible, you may read any short guide about the C language, data structures and algorithms, for example: http://www.cs.yale.edu/homes/aspnes/classes/223/notes.html, chapters 4, 5, may be 3 (if you use Linux).

    But again, it's very difficult to give an advice without any knowledge about the trial, your background and skills.

  • Default User Avatar

    Well thanks a lot !

    I have a 3 weeks preliminary trial in august, all in C, I won't be allowed to used library, only hand made code, so I'm trying my best to learn the best practice starting now. I went until the linked list and doing a makefile, would you have any other thing to recommand me to learn beforehand ?

    (sorry for any english error, I'm not a native speaker)

  • Default User Avatar

    Hi,

    Your description of the solution is correct.

    Feel free to ask any questions, and good luck with learning the C language.

  • Default User Avatar

    Hey, I'm a beginner in C, and I'm trying to understand your solution, can you tell me if I'm wrong somewhere ?

    You create an empty char, in which you put digits first char, then digits++ makes it so it's points to digits next char if there's one. It's your loop end condition, c being unable of changing value because digits doesn't have a next value.
    Then ternary condition to store the wanted value in buffer, that I get. It then advance buffer by one.
    The buffer = c part is only usefull in the last turn of the loop, to effectively put the \0 in buffer. For the previous turns of the loop, it puts digits value so 1-9, which then get erased by it's binary value (or \0)

    I have to say (beginner words), it's a great use of ++ after variables and pointers instead of before variables ! It confused me at first, but it's very logical in your code.

  • Custom User Avatar
  • Default User Avatar

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

  • Default User Avatar

    Very good kata "story", thanks a lot !

  • Default User Avatar

    Is there a reason you didn't initialized ans at -1 directly ?

  • Custom User Avatar

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

  • Loading more items...