Ad
  • Default User Avatar

    I can add any amount of bacteria each morning... so the answer is always one day??

  • Custom User Avatar

    Strange, my code didn't work FEW DAYS AGO (for basic tests), but now (when i give it a try) it works like charm !

  • Custom User Avatar

    element lookup and removal in sets is much much faster than arrays

  • Custom User Avatar

    Yes, I completed it.

    nth roots? Turn exactly 180°. This kata is about powers, not roots.

    O( sqrt n * log n ) seems about right though. Does that time out? Are you using appropriate data types and structures?

  • Default User Avatar

    Has anyone completed the JavaScript version of this yet?

    The solutions I've come up with so far either need to loop through √n * log2(n) variants or have to deal with nth roots which aren't precise in JS.

    Could anyone point me in the right direction please?

  • Custom User Avatar

    Thank you very much, I have already tried these.

    I was just curious if there was any way to properly submit my solution.

    But really thank you!

  • Custom User Avatar

    Optimize your solution for n as large as 1010.

    You could comment out the 1e6 example test; if you can pass the smaller ones you know you need moar speed.

  • Custom User Avatar

    My attempt to run the test fails as it always times out.

    I assume it's because n couldn't be more than a certain amount?

    I am really sorry if the solution is just as obvious as it may seem, but I am quite a rookie in this whole coding field.

    I would honestly appreciate any help!

  • Custom User Avatar
  • Custom User Avatar
  • Default User Avatar

    Agreed...from reading the example I quickly assumed it ended at the third power. Thanks for looking into it.

  • Custom User Avatar

    OK, you're missing 32 = 25. b is not limited to 3. You could limit yourself to prime values of b, but you have time to do all of them; that's probably easier. Also, filtering an array of size n is never going to work for n up to 1010. You'll need a major redesign.

  • Custom User Avatar

    If you post which numbers you think are representable as powers, I can also look into it.

  • Default User Avatar

    Thanks I'll look into it.

  • Custom User Avatar

    I get [ 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100 ]. That's 12 of 'em, so 89 can't be correct.

    You might also get an off-by-one error by counting powers up to but not including n, and subtracting that from n. But that would be silly.

  • Loading more items...