Questions tagged [programming-challenge]
Use this tag when the code is a solution to a programming challenge. Always include a sufficient description of the problem to be solved - while a link to the challenge is welcome, the review request needs to be complete when the challenge site is unavailable.
3,294 questions
4
votes
1
answer
73
views
Efficient way to win points in chocolate bowl game
I'm working on an optimization problem involving a turn-based chocolate-sharing game, and I need help optimizing my current brute-force solution.
Problem Description:
You and your friend take turns ...
7
votes
1
answer
68
views
.net core web API simple app with one endpoint
I am trying to complete a challenge - a simple .net core API with one simple endpoint. This endpoint should validate the user's information
and return a unique ID. He should provide: 1) Name, 2) ...
5
votes
2
answers
173
views
LeetCode Number 416: Partition Equal Subset Sum
Problem: MLE
I am confused as to why the LeetCode judge reports Memory Limit Exceeded when my solution looks close to the editorial solution. I not too familiar with ...
7
votes
4
answers
942
views
Project Euler #54: class for poker hands
I'm working right now on Project Euler problem 54, and I figured that this was the perfect opportunity to try to work with classes. This is my first time, so I'm sure that there are a lot of style, ...
7
votes
5
answers
2k
views
Solving an easy LeetCode "Merge Strings Alternately"
I am a C++ dev trying to solve problems in C to practice it, specifically the LeetCode Merge Strings Alternately problem:
You are given two strings word1 and word2. Merge the strings by adding ...
6
votes
2
answers
232
views
(HackerRank) Project Euler+ #250: 250250
Link to problem: linkNumber of solvers: 27 out of 844Solve rate (per person): 3.199%Success rate (over all submissions): 1.78%
Project Euler+ on HackerRank is basically supposed to be a generalization ...
5
votes
3
answers
957
views
LeetCode 678: Valid Parenthesis String, Recursion memoization to DP
How can the following recursion + memoization code be converted into a tabulation format dynamic programming solution?
The code is working, but I want to improve it.
The challenge I am facing is ...
7
votes
4
answers
1k
views
LeetCode 977: Squares of a sorted array, maintaining non-decreasing order
I tried solving the LeetCode question like many others, trying to incorporate the O(n) time complexity requirement.
Squares of a Sorted Array
Given an integer array ...
8
votes
2
answers
196
views
Leetcode 93: Restore IP Addresses (C version)
This is posted in response to this request made in a discussion of my "C-ish" answer to a recent Code Review question regarding a Python solution to a Leetcode challenge. It was reported ...
11
votes
4
answers
2k
views
Leetcode 93: Restore IP Addresses
(Source: Leetcode 93: Restore IP Addresses [Medium])(Topics: [String] [Backtracking])
The problem is as follows:
Definition: A valid IP address is defined to consist of exactly four integers ...
6
votes
2
answers
387
views
Rust implementation of Euler problems
I'm starting to learn rust and figured my first simple project would be to solve some of the Euler problems. I'd appreciate if anyone could tell me where I might be ...
2
votes
2
answers
129
views
Pattern Finding In Lists of Strings (2d Char Array), Advent of Code Day 04 Solution
This is part 2 of Day 4 of 2024's AoC: The problem is as follows:
It's an X-MAS puzzle in which you're supposed to find two MAS in the shape of an X. One way to achieve that is like this:
...
5
votes
5
answers
840
views
Bracket matching - Advent of Code 2021 Day 10
The following code solves Advent Of Code 2021 Day 10.
The goal for this time around is evaluating whether a line of brackets
is complete, has a syntax error or is missing some closing brackets.
...
4
votes
2
answers
959
views
LeetCode 3366: Minimum Array Sum - w/o DP/memoisation
This program tried to solve LeetCode problem 3366: Minimum Array Sum.
It fails for k odd, op1+op2 high enough such there are more odd value to optionally subtract k from than subtractions to allot.
A ...
2
votes
1
answer
76
views
Advent of Code 2024 - Day 1 (Common Lisp)
I have recently started learning lisp by reading ANSI Common Lisp, and I thought advent of code would be good for practice. Any feedback on my code for Day 1 would be appreciated.
...