Ad
  • Default User Avatar

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

  • Default User Avatar

    Thank you for your comment. I think you're right, so i refactored my solution.

  • Default User Avatar

    The task here is to decipher the task. :D

  • Default User Avatar

    String str = "abc";

    is equivalent to:

    char data[] = {'a', 'b', 'c'};

    (http://docs.oracle.com/javase/8/docs/api/java/lang/String.html)

  • Default User Avatar

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

  • Default User Avatar

    imho it's always a good idea to be prepared
    (you will often see here on codewars, that the visible test-cases not always cover all posible incidents)

  • Default User Avatar

    once again...

    date_nb_days(100, 150, 2.00) --> "2035-12-26" (7299 days)

    from 2016-01-01 to 2035-01-01 = 19 years, right?
    from 2016-01-01 to 2036-01-01 = 20 years, right?
    from 2016-01-01 to 2035-12-26 < 20 years, right?
    years | sum | interest
    00 | 100,000 | 0,000
    01 | 102,000 | 2,000
    02 | 104,040 | 2,040
    03 | 106,121 | 2,081
    04 | 108,243 | 2,122
    05 | 110,408 | 2,165
    06 | 112,616 | 2,208
    07 | 114,869 | 2,252
    08 | 117,166 | 2,297
    09 | 119,509 | 2,343
    10 | 121,899 | 2,390
    11 | 124,337 | 2,438
    12 | 126,824 | 2,487
    13 | 129,361 | 2,536
    14 | 131,948 | 2,587
    15 | 134,587 | 2,639
    16 | 137,279 | 2,692
    17 | 140,024 | 2,746
    18 | 142,825 | 2,800
    19 | 145,681 | 2,856
    20 | 148,595 | 2,914
    21 | 151,567 | 2,972

    to get 150 it needs more than 20 years
    can someone pls explain whats wrong with my calculation?

  • Default User Avatar

    so until that you compound annually
    and then daily...

    when I compound only daily, it's the same result:
    interestsPerDay = 100 * 0,0098 / 360 = 0,00272222222222222222222222222222
    days = 1 / 0,00272222222222222222222222222222 = 367,34693877551020408163265306152
    why is the answer 366 days?

  • Default User Avatar

    Hello, I'm confused... and can't find my fault - please help!

    As an example you give "date_nb_days(100, 101, 0.98) --> "2017-01-01" (366 days)".
    After a year: 100 -> 100,98 (100 * 1,0098 or 100 + 100 * 0,98 / 100 ) and 360 days.
    InterestsPerDay now: 100,98 * 0,98 / 36000 = 0,0027489.
    days / sum
    361 / 100,9827489
    362 / 100,9854978
    363 / 100,9882467
    364 / 100,9909956
    365 / 100,9937445
    366 / 100,9964934
    367 / 100,9992423
    368 / 101,0019912

    other try:
    0,02 / 0,0027489 = 7,2756375277383680745025282840409

    Can you please explain, how you came to 366 days?

  • Default User Avatar

    Dear g964, not a problem, but inconsistency.
    in your examples:
    "[["M: 37", "B: 5", "C: 4"], ["M: 100", "B: 14", "C: 11"]]"
    in test cases:
    "[[M: 37 B: 5 C: 4][M: 100 B: 14 C: 11]]"

    Thank you for that kata. It was fun to solve it ;]

  • Default User Avatar

    look for the difference in these two lines:

    [[M: 37 B: 5 C: 4][][M: 100 B: 14 C: 11]...
    [[M: 37 B: 5 C: 4][, ][M: 100 B: 14 C: 11]...

  • Default User Avatar

    Thx shaurya157!

  • Default User Avatar

    Hello WilliamWu, i tested your code and it's incomplete!
    It only runs if m < n.

  • Default User Avatar

    Pls look at my solution and see "the problem".
    I dont know how to "fix it".

  • Default User Avatar

    Thank you very much for this kata.
    It was a nice challenge, with a lot of learning effects and fun :-D

  • Loading more items...