All Questions
Tagged with exercism or programming-challenge
3,358 questions
0
votes
1
answer
54
views
Advent of Code 2023 - Day 9: Mirage Maintenance
Part 1:
The task involves analyzing an environmental report from an oasis using the
Oasis And Sand Instability Sensor (OASIS). The report consists of multiple
histories, each containing a sequence of ...
0
votes
1
answer
57
views
Advent of Code 2023 - Day 8: Haunted Wasteland (Part 1)
Description:
The task involves navigating a haunted wasteland on a desert island using a camel. The objective is to escape from the current position (AAA) to the destination (ZZZ) by following left/...
2
votes
1
answer
169
views
Codewars 4 Kyu kata: "Most frequently used words in a text"
This was the first kata I found hard so I wanted to ask about it. Any ways I could I have done it better?
here's the question -> Most frequently used words in a text
...
2
votes
3
answers
746
views
Find median value of two Sorted Arrays
To improve my coding knowledge can you please give me suggested changes on my code?
...
4
votes
1
answer
107
views
Advent of Code 2023 - Day 6: Wait For It
Part One:
The task involves organizing multiple toy boat races, each assigned a specific race time and a recorded distance. To surpass the existing record, participants must optimize the duration of ...
2
votes
1
answer
134
views
Advent of Code 2023 - Day 5: If You Give A Seed A Fertilizer (Part 1)
The task involves determining the lowest location number corresponding to a given set of seeds by following numerical mappings for soil, fertilizer, water, light, temperature, humidity, and location.
...
3
votes
1
answer
95
views
Finding the number of "block chains" that are a certain length and begin with a certain string
I'm currently practicing for the british informatics olympiad by doing past papers.
I was doing question 3 of the 2019 paper:
A set of children’s blocks, each illustrated with a single different ...
3
votes
2
answers
167
views
Advent of Code 2023 - Day 4: Scratchcards
Part 1:
The task involves determining the total points of a set of scratchcards. Each scratchcard contains two lists of numbers: the winning numbers and the numbers the player has. Points are awarded ...
6
votes
2
answers
218
views
Advent of Code 2023 day 1: Trebuchet (Part 1 and 2) Follow-up
This is a follow-up to the question asked here: Advent of Code 2023 day 1:
Trebuchet (Part 1 and 2)
Changes made:
The code no longer assumes that all lines will fit into a fixed-size buffer. Although ...
1
vote
1
answer
143
views
Advent of Code 2023 - Day 2: Cube Conundrum
Part 1:
The challenge involves analyzing recorded games where an Elf reveals subsets of cubes in a bag, each identified by a game ID. The goal is to determine which games would be possible if the bag ...
2
votes
2
answers
391
views
Advent of Code 2023 Day 3, Part 2 in Python
Part 2
I'm not sure if my solution covers all edge cases. The puzzle goes as follows: Given some input like this:
...
4
votes
1
answer
76
views
Advent of code 2023 day 9: Sequence extrapolation - in pure Bash
Part 1
Today's task involves extrapolating the next value in sequences, given in this format:
0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45
The task is to ...
5
votes
1
answer
170
views
Advent of Code 2023, Day 8 Part 1 - Beginner Rust Solution
Context
I'm doing Advent of Code as a way of learning Rust, and have a working solution to Day 8, Part 1. This involves moving between nodes, starting at AAA and ...
1
vote
0
answers
33
views
Advent of code 2023 day 8: Path finding in the desert - in pure Bash
Part 1
In today's task, a network of paths is defined like this:
LLR
AAA = (BBB, BBB)
BBB = (AAA, ZZZ)
ZZZ = (ZZZ, ZZZ)
The first line ...
4
votes
1
answer
115
views
Advent of Code 2023 day 1: Trebuchet (Part 1 and 2)
Part 1:
The task involves analyzing a calibration document containing lines of text. Each line represents a calibration value that needs to be recovered by extracting the first and last digits and ...
1
vote
1
answer
88
views
Advent of Code Day 8
The task
A file similar to the following is provided.
...
0
votes
1
answer
101
views
Advent of Code 2023 day 1: Trebuchet in JS, part 2
The task involves analyzing a bunch of lines containing lines of text. Each line represents a calibration value that needs to be recovered by extracting the first and last digits and combining them ...
2
votes
0
answers
76
views
Advent of code 2023 day 7: Ranking Camel Cards hands - mostly in Bash
Part 1
Today's task is to rank hands in a Camel Cards game and compute the total score.
In Camel Cards, you get a list of hands, and your goal is to order
them based on the strength of each hand. A ...
2
votes
1
answer
74
views
Advent of Code 2023 day 1: Trebuchet in JS
The task involves analyzing a bunch of lines containing lines of text. Each line represents a calibration value that needs to be recovered by extracting the first and last digits and combining them ...
4
votes
1
answer
447
views
Advent of Code 2023 day 1: Trebuchet
Part 1:
The task involves analyzing a calibration document containing lines of text. Each line represents a calibration value that needs to be recovered by extracting the first and last digits and ...
2
votes
0
answers
41
views
Advent of code 2023 day 6: Count ways to win boat race - in pure Bash
Part 1
To paraphrase the puzzle, given the times and record distances of boat races like this:
Time: 7 15 30
Distance: 9 40 200
That is, the first ...
1
vote
1
answer
72
views
String represents a road. One character travels on the road obeying the stops - Code challenge (advent.js day 5)
This is my code to solve the 5th Adventjs challenge. In that link you can read the instructions.
How can I improve it? It's a bit messy... and I'm repeating some part of the code.
All must be in just ...
5
votes
2
answers
1k
views
Advent of code 2023 day 4: Count scratchcard points - mostly in Bash
Yesterday I thought was the last day of Advent Of Code 2023 that I do in Bash. I was wrong. I'm not even sure anymore that today will be the one. We'll just have to see tomorrow!
Part 1
To paraphrase ...
1
vote
0
answers
103
views
Advent of code 2023 day 3: count engine part numbers - in pure Bash
Yes I'll keep doing this until I cannot be bothered to do it in Bash ;-) (Well today is probably the last one ;-))
Part 1
To paraphrase the puzzle, given some input ("engine schematic") like ...
2
votes
1
answer
156
views
Advent of Code 2023 Day 2 in C#
To paraphrase the puzzle, Santa takes a walk with an Elf, and they play a game involving a bag of colorful cubes. In each game, there is an unknown number of each colored cubes in the bag, and the Elf ...
6
votes
2
answers
1k
views
Advent of code 2023 day 2: count possible qube games - in pure Bash
To paraphrase the puzzle, Santa takes a walk with an Elf, and they play a game involving a bag of colorful cubes. In each game, there is an unknown number of each colored cubes in the bag, and the Elf ...
5
votes
1
answer
201
views
Advent of code 2023 day 1: count trebuchet calibration numbers - mostly in Bash
It's that time of the year again!
Although there's no more Winter Bash, we can still have all the Bash we want in winter ;-)
Part 1
To paraphrase the description:
For each line in the input:
Find ...
1
vote
1
answer
90
views
HackerRank Algorithm Problem: Climbing the Leaderboard (Python)
Here is the Hackerrank problem which is related to dense ranking and below is my solution which didn't pass the time limit cases. Any better way to optimize this?
...
3
votes
2
answers
308
views
Trailing Digits
https://www.acmicpc.net/problem/23204
I've solved a programming challenge where you need to count the occurrences of a specific digit at the end of the product of multiples of a given number within a ...
0
votes
1
answer
118
views
HackerRank Project Euler 12 (Python) | Highly Divisible Triangular Numbers
I again share my Python code which didn't pass time limit test cases in the HackerRank contest of ProjectEuler.
...
1
vote
1
answer
105
views
Project Euler 10(Python) | Summation of Primes
This is my Python3 code which solved the 10th problem of Project Euler. I haven't passed the last 2 time limit test cases.
...
3
votes
1
answer
328
views
Project Euler 60: Prime Pair Sets
Project Euler Prime Pair Sets:
The primes 3, 7, 109, and 673 are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime.
For example, taking 7 ...
4
votes
4
answers
180
views
Determine top t values with few calls to order(), a given procedure to order k values
I tried to write a decent answer to Most efficient way to get the largest 3 elements of an array using no comparisons but a procedure for ordering 5 elements descendantly.
I could not come up with ...
2
votes
1
answer
111
views
Codeforces: Dasha & Nightmares
so I got started with competitive programming about a day ago and I got stuck on the first random question I tried on codeforces. It's called Dasha and Nightmares.
Problem Description:
The problem ...
2
votes
2
answers
317
views
Given an array, remove zero or more elements to maximize the reduction where you add odd values and subtract even values
Here's a code challenge I got. (I could not solve the challenge, I ran out of time. I rephrased the challenge language and I am trying the challenge again for personal growth & computer science ...
2
votes
5
answers
286
views
Sum of bitwise XOR of each subarray weighted by length
here is the problem statement
You are given an array a of length n consisting of non-negative integers.
You have to calculate the value of \$\sum_{l=1}^n \sum_{r=l}^n f(l,r)\cdot (r - l + 1)\$ where \...
2
votes
1
answer
100
views
Project Euler Problem 1: Multiples of 3 or 5
The following is my solution to Project Euler Problem 1: Multiples of 3 or 5.
...
3
votes
3
answers
507
views
Increment a large integer represented as array of digits
This problem can be found at LeetCode. Since I was studying idiomatic or 'pythonic' code in my language today, I decided to take the most 'pythonic' approach and challenged myself to do this in one ...
3
votes
1
answer
113
views
Autocomplete system with prefix tree
I am quite new to Haskell, and this problem is from dailycodingproblem.com:
Implement an autocomplete system.
That is, given a query string s and a set of all ...
4
votes
3
answers
845
views
Codewars: Multiplying Polynomials
I'm trying to solve the following Kata from Codewars in Python.
My code produces the desired result for all the tests, yet it is not optimal, so it takes too much time to accomplish the big tests.
<...
3
votes
1
answer
358
views
Python function to find the count of digits of numerals in base n up to a given limit
This is a simple exercise to find the count of digits of all numerals in a given base up to a given limit (not including the limit), I wrote it to determine the ratio of bytes saved when the numbers ...
0
votes
1
answer
313
views
HackerRank "Digit sum" challenge
Here's the question:
...
4
votes
4
answers
1k
views
Lottery Analysis (Python Crash Course, exercise 9-15)
I was working on Python Crash Course, exercise 9-15: 'Lottery Analysis'. It took me a very long time to get it to work. The reason it took that long is I wanted to use my existing class from the ...
1
vote
1
answer
154
views
Calculate the cost of Biryani lessons
Problem:
According to a recent survey, Biryani is the most ordered food. Chef
wants to learn how to make world-class Biryani from a MasterChef. The
chef will be required to attend the MasterChef's ...
0
votes
1
answer
250
views
Python Logic Gate Circuit Simulator [closed]
I have recently become interested in simulating logic circuits because of a electronics class at school. I have created a functioning simulator for logic gate circuits in Python. My implementation ...
0
votes
3
answers
198
views
Efficient Solution for Finding Product of Largest Pair in Array
Hello fellow developers,
I have written a function called max_product that aims to find the product of the largest two integers in a unique array of positive ...
1
vote
1
answer
162
views
Determine the chance a streak of 6 HEADs or 6 TAILS appear in 100 flips, repeated 10000 times [closed]
Here's the problem from the book Automate the boring stuff:
write a program to find out how often a streak of six heads or a streak of six tails comes up in a randomly generated list of heads and ...
5
votes
2
answers
152
views
Generating Pascal's Triangle in C99
I recently completed the Pascal's Triangle challenge on leetcode. I would like to have my code reviewed.
You don't need a leetcode account to see the description of the challenge linked above, but for ...
4
votes
1
answer
136
views
Find the longest palindromic subsequence - Using a hashmap in Rust
This is a leetcode question which I wanted to solve using Rust as I'm learning Rust at the moment. I would appreciate some feedback on how to write it idiomatically.
Link to the question: https://...
2
votes
3
answers
548
views
Recursive palindrome check
I'm trying to solve this which basically calls for a recursive palindrome check with some minor extra steps (Special characters and whitespace can be ignored). The test inputs' length can be 100000 ...