Skip to main content

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 votes
2 answers
485 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 (...
Jared McCarthy's user avatar
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 ...
Jared McCarthy's user avatar
0 votes
3 answers
213 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-...
Dovud Jo'rayev's user avatar
4 votes
3 answers
443 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 ...
Stony's user avatar
  • 107
5 votes
3 answers
555 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 ...
Stony's user avatar
  • 107
7 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 ...
polfosol's user avatar
  • 319
5 votes
2 answers
404 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 ...
Aya Noaman's user avatar
3 votes
2 answers
248 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 ...
bruno's user avatar
  • 212
4 votes
1 answer
194 views

Place queens and rooks with the higher score (extension of the queen problem)

This is a continuation of the question N queen problem-like (+rooks and a different goal) written by someone else, where I answered. EDIT I continued to work on the subject and a third implementation ...
bruno's user avatar
  • 212
5 votes
3 answers
1k views

Project Euler Problem #1: Multiples of 3 or 5

Project Euler Problem #1 Multiples of 3 or 5 states: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of ...
toolic's user avatar
  • 15.8k
6 votes
2 answers
457 views

(Codewars) Goldbach's Conjecture (by @rsalgado) in Ruby

Link to kata: linkRank: 6 kyuKata author: @rsalgado I have been recently learning Ruby-lang and have been attempting to solve the following kata from Codewars involving Goldbach's Conjecture: ...
CrSb0001's user avatar
  • 619
6 votes
2 answers
731 views

Weather Observation Station 8 query

Here's my (correct) solution to a HackerRank question: Weather Observation Station 8 Query the list of CITY names from STATION which have vowels (i.e., a, e, i, o, and u) as both their first and last ...
JTB's user avatar
  • 277
6 votes
1 answer
590 views

Substring = Permutation of a given pattern

I am working on a problem on LeetCode. Considering only lowercase characters from 'a' to 'z', I have written some Java code to check if a permutation of a given pattern is a substring of a given ...
EngineerP's user avatar
1 vote
1 answer
174 views

FreeCodeCamp todo list

I'm writing JS for the FreeCodeCamp todo list; the corresponding HTML and CSS for this can be found on their page. I have made one edit to the HTML - the button with type "submit" has been ...
ApexPolenta's user avatar
4 votes
1 answer
118 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 ...
CodeCrusader's user avatar

15 30 50 per page
1
2 3 4 5
227