Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

New answers tagged

3 votes

The smallest positive number that is evenly divisible by all of the numbers from 1 to 20

Straight. If you - defined "the range-LCM" in a function with a docsting - presented imports  and test cases or usage examples, - added boundary checks (try ...
user avatar
  • 4,363
0 votes

The largest palindrome made from the product of two 3-digit numbers

Your upper_limit and lower_limit variable definition is a little bit complicated because it involves integer division. _ ...
user avatar
  • 1,248
1 vote

The largest palindrome made from the product of two 3-digit numbers

Style Guide for Python Code A few PEP 8 items: parenthesis are unnecessary in (10**(n))-1; write 10 ** n - 1 use a space around ...
user avatar
  • 30.4k
3 votes

The largest palindrome made from the product of two 3-digit numbers

Outsource secondary calculations to helper functions. Your current code is reasonable. Its primary drawback is that the Euler-solving code is cluttered up with the details of checking for palindrome ...
user avatar
  • 9,615
3 votes

Calculate the first largest factor of 600851475143

There is a style guide for Python you can consult. There is no use in trying to be creative when formatting the code, so you should write _ ...
user avatar
  • 1,248
4 votes

Calculate the first largest factor of 600851475143

Couple of points: Use integer division, the double slash //. This has an update partner //= too so ...
user avatar
  • 276
2 votes

Deepest pit of an array

function deepest_pit(B) { The JavaScript style guide here indicates that camelCase is recommended for functions. JavaScript is ...
user avatar
6 votes

Deepest pit of an array

Overall, reading this code, my reaction is "huh?". It looks like a bunch of gibberish at first (and second) glance. There are no english words. I would not want to maintain this code after ...
user avatar
-1 votes

Letter Changes coderbyte

I would use a hash table to keep things simpler ...
user avatar
1 vote

Find the 'n' most frequent words in a text, aka word frequency

Comments are inline in /// ...
user avatar
  • 121
-1 votes

New Year Chaos JavaScript, needs to be sped up

The input array is: [1 2 5 3 7 8 6 4], which means that: 5 jumps 2 positions, so increment counter by 2 (c = 2) 7 jumps 2 positions, so increment counter by 2 (c = 4) 8 jumps 2 positions, so ...
user avatar
-1 votes

LeetCode: House Robber II C#

Here is another version of a solution ...
user avatar
  • 5,249
1 vote
Accepted

JavaScript function that generates Fibonacci like sequences of given order

Your algorithm for an n element Fibbonacci series order k is O(N*K) Your JavaScript implementation may be inefficient. I revised your algorithm to become O(N). I revised your JavaScript implementation ...
user avatar
  • 3,283

Top 50 recent answers are included