Wow, your Algorithm2 is nearly identical to mine, except I used a foreach loop instead of a for loop; foreach was about ~10% faster when I was testing both routes.
This should not be marked as good practise. It has a very bad performance due to it being brute force.
Try running "solve $ replicate 100 [1..100]".
Warning! You will most likely run out of memory and crash the pc. Other more optimized solutions are basically solved instantly.
I doubt that banker's rounding is used for rounding prices. For example, the IRS rounding rule is to round half up. Most programming languages also use this rule for positive numbers (the only exceptions which I know are Python, R, .Net languages). So the expected rounding behavior should be clearly specified.
i < res.size()
so only initialized elements are accessed.Using a deterministic equation as a solution for a contrived problem would pass the strictest of PR code reviews. Sorry not sorry.
there is best way to write clean code and this not one of it ;
its static one
be sure to mark my reply down again
This comment is hidden because it contains spoiler information about the solution
战神
It's like saying "if you don't have
using System
, you can't useConsole.WriteLine
...no kidding.Wow, your Algorithm2 is nearly identical to mine, except I used a foreach loop instead of a for loop; foreach was about ~10% faster when I was testing both routes.
This should not be marked as good practise. It has a very bad performance due to it being brute force.
Try running "solve $ replicate 100 [1..100]".
Warning! You will most likely run out of memory and crash the pc. Other more optimized solutions are basically solved instantly.
I doubt that banker's rounding is used for rounding prices. For example, the IRS rounding rule is to round half up. Most programming languages also use this rule for positive numbers (the only exceptions which I know are Python, R, .Net languages). So the expected rounding behavior should be clearly specified.
awesome solution!
fixed
Approved
My bad, I keep forgetting const is properly memoized here.
Should be fixed but my internet is toastering out so might not have saved.
String.init len @@ const @@ Random.choice @@ Array.enum chars
Do not use
const
here. All generated words are in the form"AAAAAA"
(one character repeatedlen
times).It's all a math problem.
Loading more items...