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,401 questions
4
votes
3
answers
131
views
Unix WC Implementation V2
Code: https://github.com/Loki-Astari/Puzzle/tree/master/wc
Challenge: https://codingchallenges.fyi/challenges/challenge-wc/
Previous attempt: Unix WC Implementation
The original one would scan a 50M ...
9
votes
7
answers
1k
views
Unix WC Implementation
Code: https://github.com/Loki-Astari/Puzzle/tree/master/wc
Challenge: https://codingchallenges.fyi/challenges/challenge-wc/
wc.cpp
...
7
votes
2
answers
908
views
JSON Parser in C++
I wrote a JSON parser for a coding challenge: https://codingchallenges.fyi/challenges/challenge-json-parser
It's a recursive descent parser that just tells whether the JSON string is of proper syntax.
...
2
votes
0
answers
135
views
Advent of Code 2016 Day 14 - Part 1
TL;DR: 5 ms for part one and 0.75 seconds for part two (multi-threaded on an aged i13900K laptop); the fiddle also works as a LINQPad script (a cleaned-up version for only part one is at the end of ...
7
votes
2
answers
787
views
LeetCode 22. Generate Parentheses (C++)
The task is taken from LeetCode. I would appreciate an assessment of whether my coding style follows good practices. I'm fairly familiar with algorithms and data structures so I'm not really looking ...
8
votes
3
answers
831
views
LeetCode 2. Add Two Numbers
The task is taken from LeetCode. I would appreciate an assessment of whether my coding style follows good practices, and if there are any habits or patterns you would find concerning when working ...
2
votes
3
answers
1k
views
LeetCode 3542: Minimum Operations to Convert All Elements to Zero
I am working on this LeetCode problem where I have to count the minimum number of operations to make all elements in an array equal to zero 3542. Minimum Operations to Convert All Elements to Zero
...
4
votes
2
answers
528
views
Finding a sequence of xors to change a to b
I'm resolving a problem from CodeForces: C. Beautiful XOR. This is what the code is supposed to do:
You have two numbers a and b.
You must transform a into b using XOR operations (...
5
votes
5
answers
1k
views
Check whether a binary tree is symmetric
I implemented a recursive solution that compares the left and right subtree in mirrored fashion. It works for my test cases, but I would like to know if there are any best practices that would make ...
0
votes
3
answers
237
views
C# quicksort implementation (LeetCode Sort an Array)
I implemented quick sort after merge sort as part of LeetCode question for sorting an array. The solution code can be found at https://leetcode.com/problems/sort-an-array/solutions/7180269/i-...
4
votes
3
answers
463
views
FOLLOW-UP to the Strength of a Pyramid Top post with a revised code example
As a follow-up to my previous question, I've decided to post a follow-up question with a revised code that accommodates most of the inputs from the previous question's comments, namely:
Used ...
5
votes
3
answers
583
views
Strength of a Pyramid Top
I need to solve the following competitive programming problem from coderun.ru:
Strength of a Pyramid Top
The pyramid consists of n horizontal layers of blocks: the first layer contains n blocks, the ...
8
votes
4
answers
1k
views
Project Euler #909: L-Expressions I
I am trying to solve the 909th challenge of Project Euler. It is basically about replacing specific patterns in a string until no pattern is found. A given string like ...
5
votes
2
answers
434
views
Wordsearch Generator (Tracking Success/Failure)
I'm creating a wordsearch generator that takes a list of words and outputs a 10x10 grid (2D array) of letters. This is roughly how it works:
loop over words
use boolean ...
3
votes
2
answers
267
views
Third way to place queens and rooks with the higher score (extension of the queen problem)
Here is a third implementation, the second is in my question Place queens and rooks with the higher score (extension of the queen problem) and an initial one is in my answer for the question N queen ...