7 kyu

Target Date

420 of 3,257g964
Description
Loading description...
Fundamentals
Mathematics
  • Please sign in or sign up to leave a comment.
  • Karot1 Avatar

    Confusing at first but pretty good!

  • ahmadSaeedGoda Avatar

    Tricky one as usual, but really good one!

  • ptihiy Avatar

    No offence, but when I see the kata of this author I just skip...

  • marjan Avatar

    Is that true: a0=3878 a=4977 p=6 Expected: equal to "2020-02-07" Actual: "2020-02-06"

  • trashy_incel Avatar

    C fork

    • proper assertion messages
    • initial code no longer crashes
    • it is explained what kind of pointer to return
  • laurelis24 Avatar

    say what you want but details are terrible.

  • tomas100 Avatar

    Im super lost with this one. In the example of dateNbDays(100, 101, 0.98) i get an answer of 368 days instead of 366 days. I can not figure out the problem. In my understanding in 360 days the interest is going to be 0.98 so in total after 360 days there is going to be 100.98 in the bank. On day 361 from 100.98 i will start counting interst of 0.98/360(per day). Which makes 100.98*(0.98/36000)= 0.0027489/day of interest. So after 366 days I get 100.9964934, after 367 I get 100.9992423 and only after 368 days I get 101.0019912. Please let me know where my logic is bad as I can not see it. Thank you!

  • nomennescio Avatar

    Description is wrong; p is NOT p percent divided by 360 per day, but an amount that needs to be divided by 360x100 per day.

  • Polymathic Avatar

    Is this daily compound interest or annual?

  • mnlcz Avatar

    parameter $p in powershell solution should not be of type int

  • halflucifer Avatar

    The satisfaction rating said a lot. Not worth your time.

  • Machireddy  Avatar

    You could have mentioned compound interest in instructions!!!

  • akar-0 Avatar

    This comment has been hidden.

  • RomanAlekseev Avatar

    This comment has been hidden.

  • romaxa11 Avatar

    Great.Thanks!

  • vvedenskiy Avatar

    I have a big request for all kata creators. Please, make up the description of the tasks so that their interpretation would not be painful. We are gathered here to solve mathematical, algorithmic and programming problems, and not solve dictionary puzzles.

  • Fuzzi Avatar

    Why does this not have time/date tag?

  • FArekkusu Avatar

    C++ version generates warnings.

  • Minoru-kun Avatar

    It's misleading to say "a constant interest rate of p% > 0 per year": as already pointed out, with a daily rate of p%/360 you'd get (p%/360)^360 yearly rate (for a year of 360 days). Please take this out, just say "interest rate of p%/360 per day". As it stands, the terrible description of the kata makes for a miserable experience solving it.

  • PastaBakeWizard Avatar

    For those confused, when the kata description says that "The bank considers that there are 360 days in a year", it means that every 360 days you recieve the full interest. This means that you will have had the full yearly interest rate on the 26th of December, and that you actually recieve MORE THAN the interest rate over the course of a 365 day calendar year. No days are skipped and all the months are the same length as they are in the Gregorian Calendar.

  • imjasonmiller Avatar

    I've forked the Rust translation in order to update it to Rust 1.49 and updated rand::Rng::gen_range to its new signature that takes a std::ops::Range.

  • gitriyad Avatar

    For everyone who are suffering to solve this kata.

    • interest rate is compound.
    • For daily rate use p/36000
    Kata is simple just solve it. If any query feel free to reply.
  • qmstuart Avatar

    I just get this when trying to submit or run sample tests

    Even submitting a simple function

    (defn date-nb-days [a0 a p] 0)

    Results in below:

    Exception in thread "main" java.io.FileNotFoundException: Could not locate dateamount/core__init.class or dateamount/core.clj on at clojure.lang.Compiler.load(Compiler.java:7391) at clojure.lang.Compiler.loadFile(Compiler.java:7317) at clojure.main$load_script.invokeStatic(main.clj:275) at clojure.main$script_opt.invokeStatic(main.clj:335) at clojure.main$script_opt.invoke(main.clj:330) at clojure.main$main.invokeStatic(main.clj:421) at clojure.main$main.doInvoke(main.clj:384) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.lang.Var.invoke(Var.java:379) at clojure.lang.AFn.applyToHelper(AFn.java:154) at clojure.lang.Var.applyTo(Var.java:700) at clojure.main.main(main.java:37) Caused by: java.io.FileNotFoundException: Could not locate dateamount/core__init.class or dateamount/core.clj on classpath. at clojure.lang.RT.load(RT.java:456) at clojure.lang.RT.load(RT.java:419) at clojure.core$load$fn__5677.invoke(core.clj:5893) at clojure.core$load.invokeStatic(core.clj:5892) at clojure.core$load.doInvoke(core.clj:5876) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invokeStatic(core.clj:5697) at clojure.core$load_one.invoke(core.clj:5692) at clojure.core$load_lib$fn__5626.invoke(core.clj:5737) at clojure.core$load_lib.invokeStatic(core.clj:5736) at clojure.core$load_lib.doInvoke(core.clj:5717) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invokeStatic(core.clj:648) at clojure.core$load_libs.invokeStatic(core.clj:5774) at clojure.core$load_libs.doInvoke(core.clj:5758) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invokeStatic(core.clj:648) at clojure.core$require.invokeStatic(core.clj:5796) at clojure.core$require.doInvoke(core.clj:5796) at clojure.lang.RestFn.invoke(RestFn.java:421) at dateamount.core_test$eval4$loading__5569__auto____5.invoke(test.clj:8) at dateamount.core_test$eval4.invokeStatic(test.clj:8) at dateamount.core_test$eval4.invoke(test.clj:8) at clojure.lang.Compiler.eval(Compiler.java:6927) at clojure.lang.Compiler.eval(Compiler.java:6916) at clojure.lang.Compiler.load(Compiler.java:7379) ... 11 moreclasspath., compiling:(/home/codewarrior/./test.clj:8:1)

  • user8436785 Avatar

    Please update to Julia 1.0.

  • Korvyr Avatar

    If p% is the rate for a year the rate for a day is p divided by 36000 since banks consider that there are 360 days in a year.

    Shouldn't this be p divided by 360? Dividing the rate by 36000 will give you the percentage rate for every 100th of every day rather than every day alone.

  • yozanshin Avatar

    In my opinion "p" argument should be float type as an integer makes no sense in this context.

  • stauntonjr Avatar

    This comment has been hidden.

  • hervito974 Avatar

    Please stop with variables like a1, p, x, p0...

    It does not make sense, it's not readable and fosters bad practices for beginners.

  • okurichenko Avatar

    Why just don't say that p/36000 is rate per day? Please, whoever solve this kata, don't think of p as of yearly interest rate!

  • nikkirow Avatar

    leap years?

  • dkorolyova Avatar

    It was really difficult for me to understand this kata. I had been thinking about it for three days. I understood only when I read the comments. Thank you for kata and for hints.

  • spironan Avatar

    I am attempting this kata and is very confused by a few things

    1. Is this a compound interest or simple interest, and how often is it recalcualted? (per year,month or day?)
    2. There seem to have am inconsistency of how many days are there in a year? (in the example from 2016 jan 1 -> 2017 jan 1 is considered 366 days but in the interest rate bank considers 360 day a year)
  • smithyg22 Avatar

    Great Kata, introducing me gently to a couple of new concepts - simple maths means the focus is on correctly using and formatting the date!

  • mihaineken Avatar

    The rate is paid daily and added to initial capital.

  • joki Avatar

    Just to point out that there is an error in your definition: the daily interest rate is the 360th root of p / 100 rather than p / 36000 as stated in the problem description.

    Applying p / 36000 for 360 days doesn't yield the annual interest rate of p%.

  • badvik Avatar

    Just to clear: 360 banking days doesn't mean that the same must be used at the end date calculations? I mean the dates must be "real", including leapyear consitions etc? Because I got right days quantity, but not right end date, calculated with:

    • 360 days in a year
    • 12 months
    • 30 days in a month

    p.s. dateNbDays(100.0, 101.0, 0.98) means 01/07/2017 with 360 days calendar, and not 01/01/2017 as in sample test.

  • mugiseyebrows Avatar

    [Clojure] Run tests: ok Submit: java.lang.RuntimeException: Unable to resolve symbol: ft in this context, compiling:(null:24:30) whole stacktrace https://gist.github.com/anonymous/82dbad1be4b80a4141cab11ea2dbe847

  • Joz Avatar

    it was unclear if the percent should update previous..

  • linlux 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?

  • linlux 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?

  • Chris45215 Avatar

    I think it may be helpful if you re-word the description, because it implies that the amount a0 is deposited every year. I would suggest that you phrase it as "You have an amount of money a0 > 0 and you deposit it on the 1st of January 2016, with an annual interest rate of p% > 0" This should help clear up the ambiguity in the first sentence. The reader can discern the intended meaning currently, but only because the date includes the year and thus an annual deposit wouldn't make sense. Also, you should add "compounded annually" or "compounded daily" to the end of that first sentence. Banks traditionally tell customers the interest rate in the form of the APY, which is annual, but the real interest rate is continuously compounded. So, it may be easier if you explicitly state how often it is compounded, because our banking conventions have separated the compounding frequency from the advertised "annual" rate.

  • volandy Avatar

    If daily rate is p/36000 than how can we get a right amount in 366 days with a daily added rate? (read "360 is not equal to 366").

    How is the interest added -daily, monthly, quarterly or yearly?

  • ekailia Avatar

    [Python] Run Tests: all OK Submit: all ok until 100 Random tests and got this, TypeError: descriptor 'date' requires a 'datetime.datetime' object but received a 'int'

    Seems a syntax issue?

  • tchar Avatar

    This comment has been hidden.

  • tehmarken Avatar

    In the Notes, you should probably clarify that the daily percentage p/36000 also includes the conversion p/100 for converting the interest from a percentage to a multiplier.

    You also have a typo under Task, there's an extra "d" in "(or dateNbDdays...)".

  • Contessa Avatar

    The title should be more descriptive.

  • Darnor Avatar

    For Java I'd recommend to use the Java 8 java.time.LocalDate (https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html) and not java.util.Calendar or even java.util.Date.