Ad
  • Custom User Avatar

    Hi, thanks for letting you know. I have amended my solution to support unsigned types and just resubmitted it.

  • Custom User Avatar

    haha,not really, i woke up yesterday with the urge to implement long addition from scratch and I got the best example to test my implementation here. I can also confirm that my first solution was implemented 2 years ago,when I came across a small version of the BigInt library on github. Thanks for discussion, feel free to check out my other solutions to katas since I'm a 2kyu.

  • Custom User Avatar

    Well, my second solution shows the basic way of solving the kata with no cheats, hope that proves that i can solve this.

    /* using Basic long addition */ its so fast with O(n) time complexity but more space is used. */

  • Custom User Avatar

    haha, bro, work smart not hard.

  • Custom User Avatar

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

  • Custom User Avatar

    I'm using a different version of Nodejs (v14.16) and all my tests passed but on here with version 8, they failed. All 103 passed by 20 keep failing yet, I got the right output even with the failed cases on my pc.

  • Custom User Avatar
  • Custom User Avatar

    Thanks for pointing that out. I wouldn't use this solution in production code. Thanks once again.

  • Custom User Avatar

    Guys, just ran the same tests with my solution on my pc and everything passed by on here. they don't run. I don't understand why. Could it be because of different version of node.
    My solutions run with the correct out(using the same input) but on here, it's a different case.

  • Custom User Avatar

    This isn't the most efficient way to solve this problem (cause of more allocations) . I've tested all the solutions given here and they all seem to cause a stackflow if more than 3500 elements are used(with Cons::From method).
    For anyone who wants to solve the stackflow over flow problem, fork a new thread with increased stack-size using the threadBuilder as shown below

    With Udiknedormin's solution, you build the list with upto 26000 elements using the config below

    use std::thread;
    
    const STACK_SIZE: usize = 8* 1024 *1024; // 
    
    
    
    fn main() {
       // Spawn thread with explicit stack size
       let child = thread::Builder::new()
           .stack_size(STACK_SIZE)
           .spawn(run) // run your functions in here
           .unwrap();
    
       // Wait for thread to join
       child.join().unwrap();
    }
    
    
    
  • Custom User Avatar
  • Custom User Avatar

    Hi mate, whoever translated this kata to Rust, if you can tell me that
    assertion failed: (left == right)
    left: [(20174, 34060), (2184, 3406), (25545, 34060)],
    right: [(20174, 34060), (21840, 34060), (25545, 34060)]

    correct this, my left form is the simpliest at. Clearly if there is 21840/3460, you simplifies further to 2184/3460. Don't let me cheat

  • Custom User Avatar

    This kata would do with more tests including random ones. I can't believe a 5kyu kata would be this easy.

  • Custom User Avatar

    would the creator of this kata add big.js ? its much faster than bignumber.js. would really appreciate it.

  • Custom User Avatar

    All the problem have been fixed. NO JSON.parse method, tests are working.

  • Loading more items...