5
votes
Advent of code 2023 day 2 in pure Bash
It's going to be a really minor thing, but a review is a review and thus doesn't belong in the comments.
I've learned that calling files solve_day2_part2 in an &...

Mast♦
- 13.1k
4
votes
Advent of code 2023 day 2 in pure Bash
What would you do differently?
Well, choosing a language better suited to the task springs to mind, maybe python.
In particular, I find this inconsistency distracting when reading such scripts:
...
4
votes
HackerRank Project Euler 12 (Python) | Highly Divisible Triangular Numbers
Inaccuracy
Many Project Euler problems deal with BIG numbers. These often are large enough that int(number**0.5) will give you the incorrect result!
Mathematically,...
3
votes
Advent of code 2023 day 1 mostly in Bash
For me, bash solution would rather be something like this:
Part 1
...
3
votes
Advent of code 2023 day 4 mostly in Bash
Got a tip from @choroba's alternative solution.
To conditionally initialize or update an entry in a map, instead of:
...
3
votes
Advent of code 2023 day 4 mostly in Bash
one word per line
In nums_to_lines, these six lines follow a very clear pattern.
But it seems a bit long.
I tend to use ...
2
votes
Trailing Digits
Picture yourself coming back to "V1 code" a decade from now:
You can read it, you can run it.
Do you know what does, and to what end?
Name things for what they are good for.
...
2
votes
Project Euler 10(Python) | Summation of Primes
It was clarified that this problem is the Hacker Rank version: https://www.hackerrank.com/contests/projecteuler/challenges/euler010/problem
This problem has the format of multiple test cases being ...
2
votes
Project Euler 60: Prime Pair Sets
Eliminate 2 and 5 from your sieve!
Any 2+ digit prime cannot end in a 2 or a 5, as these will be multiples of ...
1
vote
HackerRank Algorithm Problem: Climbing the Leaderboard (Python)
My approach, described below, should definitely be an improvement. I have named my version climbing_leaderboard so as to not conflict with your name (I have ...
1
vote
Trailing Digits
finally I found a link with a lot of examples. I found trailingdigits.py with a much more elegant approach github.com/RussellDash332/kattis/blob/main/src/… and another webpage that shows more detail ...
1
vote
Accepted
Given an array, remove zero or more elements to maximize the reduction where you add odd values and subtract even values
You could simply use this pattern:
[greatest value, smallest value, greatest value, smallest value, ...]
local maximum, local minimum, ...
That means, go until ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
programming-challenge × 3322python × 1002
algorithm × 654
performance × 636
java × 635
time-limit-exceeded × 500
c++ × 480
python-3.x × 437
beginner × 425
c# × 303
javascript × 288
strings × 211
primes × 182
c × 151
functional-programming × 114
array × 105
haskell × 98
python-2.x × 92
interview-questions × 91
dynamic-programming × 85
recursion × 77
object-oriented × 76
ruby × 76
palindrome × 73
combinatorics × 70