Ad
  • Custom User Avatar
  • Custom User Avatar

    can somebody explain math behind it? how did you even came up with this solution?

  • Default User Avatar
  • Custom User Avatar
  • 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.

  • Default User Avatar

    Yes, I've added one new test case (medved test) only. It's the only difference.

    And I've changed my own solution, of course.

    Thanks!

  • Custom User Avatar

    Issue is resolved

  • Default User Avatar

    The description of this kata doesn't specify the function call precedence. On the other hand, there aren't tests that depend on it. All tests can be successfully passed in both cases.

    So, you can choose any of these options (or implement two versions of the interpreter :) )

  • Default User Avatar

    C translation has been published.

    Could anyone review and approve it, please?

  • Default User Avatar

    C translation has been published.

    Could anyone review and approve it, please?

  • Default User Avatar

    Please, correct me if i'm wrong: the C random tests always use the first test case only.

    In the cpp random tests i made it test all 7 test cases.

    Hope it's al'right.

    These 7 test cases have different levels of complexity so a time consumption of different tests varies widely (depends on an algorithm).

    In C translation is used only one test case as the basis of random tests to obtain a more stable total time consumption. This is important for 10 random tests.

    Of course, for a large number of tests, the total time consumption doesn't depend on the level of complexity of individual tests.

  • Default User Avatar

    Thank you very much.

  • Loading more items...