# Questions tagged [programming-challenge]

Programming challenges are off-site challenges meant to offer programmers educational experiences while testing their abilities.

2,764 questions
Filter by
Sorted by
Tagged with
59 views

### Challenge - Construct binary tree from array [closed]

A coding challenge to construct a binary tree from an array. ...
75 views

### Project Euler # 52 Permuted multiples in Python

It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order. Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, ...
127 views

### Challenge: phone keypad to letters - return all possible strings

The challenge: Given a mapping of digits to letters (as in a phone number), and a digit string, return all possible letters the number could represent. You can assume each valid number in the ...
630 views

### JavaScript Sort Stack Coding Challenge

A coding challenge to write a function sortStack that receives a stack of integers into ascending order (with largest integers on top) and returns another stack ...
155 views

### Project Euler # 50 Consecutive prime sum in Python

The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred. The longest sum ...
253 views

### Project Euler # 49 Prime permutations in Python

The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual in two ways: (i) each of the three terms are prime, and, (ii) each of the 4-digit numbers are ...
84 views

### Project Euler # 48 Self powers in Python

The series, $1^1 + 2^2 + 3^3 + \ldots + 10^{10} = 10405071317$. Find the last ten digits of the series, $1^1 + 2^2 + 3^3 + \ldots + 1000^{1000}$. ...
93 views

79 views

### Imperative and functional-programming solutions for Jumping on the Cloud challenge

Problem Statement Emma is playing a new mobile game that starts with consecutively numbered clouds. Some of the clouds are thunderheads and others are cumulus. She can jump on any cumulus cloud ...
43 views

### Project Euler # 29: Distinct powers in Python

Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5: 2 ** 2 = 4, 2 ** 3 = 8, 2 ** 4 = 16, 2 ** 5 = 32 3 ** 2 = 9, 3 ** 3 = 27, 3 ** 4 = 81, 3 * 5 = 243 4 ** 2 = 16, 4 ** 3 = ...
25 views

### Project Euler # 28: Number spiral diagonals in Python

Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows: ...
548 views

### Counting multiples of 3 up to a given number

I'm attempting a practice problem in Codeforces that requires you to find the number of multiples of 3 less than or equal to a given number. I have written the following code but it gives a TLE once ...
3k views

### Project Euler # 25 The 1000 digit Fibonacci index

The Fibonacci sequence is defined by the recurrence relation: Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. Hence the first 12 terms will be: F1 = 1 F2 = 1 F3 = 2 F4 = 3 F5 = 5 ...
59 views

### Project Euler # 24 Lexicographic permutations in Python

A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we ...
47 views

### CodingBat: without_end

Link To Question Given a string, return a version without the first and last char, so "Hello" yields "ell". The string length will be at least 2. without_end('Hello') → 'ell' ...
44 views

### Project Euler # 22 names scores in Python

Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. ...
58 views

### Coding Challenge: Kattis

Short problem description: A sequence of numbers are antiarithemtic if there exists no three numbers a_i, a_j, ...
65 views

### Project Euler # 21 amicable numbers Python

Let $d(n)$ be defined as the sum of proper divisors of $n$ (numbers less than $n$ which divide evenly into $n$). If $d(a) = b$ and $d(b) = a$, where $a ≠ b$, then $a$ and $b$ are an ...
64 views

### Project Euler # 20 factorial digit sum in Python

n! means n × (n − 1) × ... × 3 × 2 × 1 For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. Find the sum of the ...
46 views

### Project Euler # 19 Counting Sundays in Python

You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have ...
127 views

### Letter case permutation

The question can be found here https://leetcode.com/problems/letter-case-permutation Given a string S, we can transform every letter individually to be lowercase or uppercase to create another ...
179 views

### HarckerRank 2D Arrays Hourglass challenge

About this 2D Arrays HackerRank problem. The task is to find the maximum sum of a region in a 2D array. Specifically, it is to find the maximum sum of an "hourglass" region, defined as a 3x3 square ...
164 views

### Adding a Node to the Linked List is taking a longer Time when using a reference to the Tail Node

I am trying to add two numbers in the form of linked List and return their result in a Linked List as given in https://leetcode.com/problems/add-two-numbers/ Question: You are given two non-empty ...
113 views

### Staircase challenge - Python

Your task is to print all unique ways to climb a staircase of length n where, from each step, you can take steps of size x where ...
64 views

### Project Euler #17: Number Letter Counts

If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) ...
108 views

### Project Euler #14: Longest Collatz Sequence starting point

Problem statement: The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using the rule above and starting with 13, we ...
102 views

### Counting valleys traversed below sea level, given elevation changes

Problem Statement: Gary is an avid hiker. He tracks his hikes meticulously, paying close attention to small details like topography. During his last hike he took exactly steps. For every step ...
3k views

### Project Euler, problem # 9, Pythagorean triplet

Project Euler #9, Pythagorean triplet is A Pythagorean triplet is a set of three natural numbers $a < b < c$ for which $a^2 + b^2 = c^2$. For example, \\$3^2 + 4^2 = 9 + 16 = 25 = 5^...
33 views

### Project Euler Problem # 8 maximum product of sequences

Is there any room for improvement? Your feedback would be helpful. Problem Statement: The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. Find ...
74 views

### Project Euler problem # 3 is this the most efficient approach in Python or can I do better?

The problem statement: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? This code takes 9 seconds!, is there a better way? ...
2k views

### HackerRank: Electronics Shop

Challenge from Hacker Rank - Monica wants to buy a keyboard and a USB drive from her favorite electronics store. The store has several models of each. Monica wants to spend as much as possible for ...
322 views

### Bishop game - python

A bishop can capture any other bishop if it lies along the same diagonal line, so long as no other bishop is in its path. Given a list of coordinates of the bishops locations, and a board size, ...
210 views

### Counting Valleys - HackerRank Challenge

For this challenge on HackerRank: A valley is a sequence of consecutive steps below sea level, starting with a step down from sea level and ending with a step up to sea level. Given Gary's ...
49 views

### test oriented design; Python test script to test a company's API, print test results, log exceptions

I'd like some constructive feedback on the code that I have written to test the API for smartsh33t.com I wrote it in Python. I wrote the program to take .json files and read them into the testrunner....
79 views

### “When to take medicine” CodeChef Challenge MEDIC

I just submitted this code to solve the "When to take medicine" challenge on CodeChef: ...
632 views

### Cracking the Coding Interview — 1.5 One Away

I would like to know any suggestions about to improve my code solution and your rating of my approach to the problem, I based my code on the fact that if the strings have different length removing one ...
44 views

### Find a Sum of Particles in A Set of Boxes Given a Number of Rows and Columns

This is a code challenge, from Codewars, the details of the specific challenge in depth can be found here: https://www.codewars.com/kata/magnet-particules-in-boxes/javascript. The summary of it ...
2k views

### Find The One Element In An Array That is Different From The Others

https://www.codewars.com/kata/find-the-stray-number/train/javascript I solved this challenge by sorting from least to greatest, and checking if the first element in the array matched the second ...