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's user avatar
  • 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: ...
J_H's user avatar
  • 16.9k
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,...
AJNeufeld's user avatar
  • 33.3k
3 votes

Advent of code 2023 day 1 mostly in Bash

For me, bash solution would rather be something like this: Part 1 ...
choroba's user avatar
  • 1,368
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: ...
janos's user avatar
  • 111k
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 ...
J_H's user avatar
  • 16.9k
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. ...
greybeard's user avatar
  • 6,104
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 ...
harold's user avatar
  • 9,059
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 ...
AJNeufeld's user avatar
  • 33.3k
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 ...
Booboo's user avatar
  • 749
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 ...
qleoz12's user avatar
  • 141
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 ...
Nina Scholz's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible