# Tagged Questions

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

22 views

### Pangram test with non-ASCII characters [on hold]

Pangram Determine if a sentence is a pangram. Determine if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma, "every letter") is a sentence using every letter of the ...
47 views

### Finding the total time elapsed in the union of time intervals

Given a set of time intervals, I have to find the total time elapsed in the union of the intervals. Test Cases: ...
54 views

### Project Euler problem #11 - Largest product in a grid

I have recently solved the following Project Euler problem: In the 20×20 grid below, four numbers along a diagonal line have been marked in red [here bold]. ...
71 views
+50

### Make Depth First Search program more efficient

This is a problem from programming contest. In the first line there is one integer T denoting the number of test cases. Description of T test cases follow. Each one have two integers N and K ...
54 views

### Advent of Code Day 6: toggling lights in a grid with Powershell

I am using the "Advent of Code" series to help with my PowerShell education. The Day 6 puzzle has a 1000 × 1000 grid of lights. After processing instructions to turn on, turn off, or toggle rectangles ...
47 views

### Celebration Party Problem - Algorithm

I solved the following problem: Let's consider the following situation. You've invited a lot of children to a celebration party, and you want to entertain them and also teach them something in the ...
130 views

### Count words in a string

Continuing my TDD from exercism. Write a program that given a phrase can count the occurrences of each word in that phrase. For example for the input ...
188 views

### Nucleotide Count

I am learning Java and hence practicing it from here. The solution seems pretty trivial to me but still I would like to have a honest review which would guide me to following ideas: Am I maintaining ...
66 views

### Sieve of Eratosthenes solution for CodeEval

The code below takes integer n as input, and delivers a list of all primes up to integer n using the Sieve of Eratosthenes. My question is, could you please help me optimize this code? Is it ...
37 views

### LeetCode Rotate Array

I have started learning Java and was trying to solve some easy problems from different websites like HackerRank and leetcode.I am relatively new to programming so please don't mind if this is too ...
29 views

### Project Euler Problem 10

Project Euler problem 10 is to find the sum of all primes less than 2 million. I have written a program that does this, and it works, but it takes an excruciatingly long amount of time. What I'm ...
40 views

### Topological sort using recursive DFS

I am currently learning Graph algorithms by solving questions on online judges. The below code is for implementing Topological sort, using recursive DFS. Also, it is my first time with C++ STL. ...
31 views

### Time Limit Exceeded for build_max_heap

This problem is from HackerEarth: The Monk learned about priority queues recently and asked his teacher for an interesting problem. So his teacher came up with a simple problem. He now has an ...
27 views

### Computing the in-degree of a tweet graph

This was my entry for a recent coding challenge for computing the in-degree of a tweet graph (the competition is over). The requirement was to compute the in-degree of a graph made from unique hash ...
39 views

### Pizza delivery problem: finding the best spot to set up a pizza shop

I received the following problem in an interview and submitted this solution but did not make it to the next round even though this was a working solution. I'm wondering how I can improve my code. ...
43 views

### Project Euler #23 with Java8 Streams

A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means ...
64 views

### Project Euler #44

I'm having trouble optimizing my code for the exercise in Project Euler #44 Pentagonal numbers are generated by the formula, $P_n=\frac{n(3n−1)}{2}$. The first ten pentagonal numbers are: ...
12 views

### Project Euler #8 Largest product in a series [migrated]

I am working on Project Euler's problem #8 in which I am asked to "Find the thirteen adjacent digits in this 1000-digit number that have the greatest product. What is the value of this product?" Here ...
136 views

### Project Euler #43

I'm having trouble optimizing the Project Euler problem #43 : The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also ...
102 views

### Project Euler Problem #41

I recently finished the project Euler problem # 41 : We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once. For example, 2143 is a 4-digit ...
216 views

### Project Euler #34 Digit factorials

I'm having trouble improving the performance of the solution to the Project Euler problem #34 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find the sum of all numbers which ...
40 views

### User ranking system

I have written my first code of object oriented Python. Prior to this I have spent a week on learning the concepts and understanding the technique. I would appreciate it somebody reviews this and give ...
140 views

### On Finding Coin Jams

The problem can be found here and is essentially asking us to generate J many numbers containing N many digits, where these digits have to be either 0 or 1. The catch is that the these numbers that we ...
41 views

### Copy Constructor for a linked list with self-referential pointers

I came across a coding challenge that looked something like this (recreating from memory, sorry) Suppose you have the following interface for a linked list. Implement an efficient and correct ...
46 views

### Number of ways to make change for an amount

Task Write a program that, given the amount to make change for and a list of coins prints out how many different ways you can make change from the coins to STDOUT. My approach The number to make ...
273 views

### Find prime positioned prime number

This is a question from programming contest. This contest is already over. Now, all the prime numbers are arranged sequentially in ascending order. i.e:- 2, 3, 5,7...and so on. Now, your task is to ...
192 views

### Generators in Javascript; Project Euler #2

I'm trying to learn javascript using project euler and I decided to try to force myself to learn about generators in javascript using problem number 2 which asks us to: ...
88 views

### Project Euler #23 Non-abundant sums

I'm having trouble optimizing the Project Euler problem number 23 : A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of ...
92 views

### Project Euler GUI for Problem #1 through #11

I've been working on the Project Euler problems, so I created a GUI and a Solver class for all the code I've been creating. I'd like to share it with you guys and to get general feedback on my coding ...
191 views

### Project Euler #11 Largest product in a grid

Question Link to the exercise : https://projecteuler.net/problem=11 I'm currently working on the Project Euler exercise's and I just finished the eleven exercise. It's working fast enough it takes ...
5k views

### Project Euler #7 10001st prime

I decided to start working on the Euler project exercises. I'm doing fine for now but the seventh problem is running quite slow and I can't think of anything to make it work faster. It takes around ...
46 views

### Determine whether input-output pairs represent something that could be a proper math function

The input is read in line by line from stdin. Input Format The first line contains an integer, T, denoting the number of test cases. The subsequent lines describe T test cases, and ...
60 views

### Project Euler - Smallest multiple (Ruby)

My code is very slow to run, and I am trying to find a way to make it more efficient. I know there must be a better way than to write each modulo operation. The goal of the script is to find the ...
106 views

### Finding all contiguous sublists such that each member appears an even number of times

The program needs to find all contiguous sublists of numbers where the number of occurrences of every member in the contiguous sublist is divisible by 2. The first line of input is N (the number of ...
191 views

### Google Foobar challenge: Rabbit Test Subjects

The diabolical Professor Boolean has captured you and a group of your hapless rabbit kin as test subjects for his terrible experiments! You're not sure what his real plans are, but currently it ...
88 views

### UVA #10258 - Contest Scoreboard

The problem statement is here. Problem Description The task is to rank the contestants in the contest based on following criteria Contestants are ranked first by the number of problems solved (the ...
84 views

### Matrix rotation

Continuing on my VB.NET quest, I came across this slightly more challenging problem. You are given a 2D matrix, a, of dimension $M$x$N$ and a positive integer $R$. You have to rotate the ...
60 views

### Hackerrank Insertion Sort Part 2

I have started learning Java recently and was looking into the challenges on sorting on Hackerrank.I solved the following problemHackerrank on Insertion Sort. The challenge was : In Insertion ...
50 views

### Project Euler #127 abc-hits

Problem (Rephrased from here): The radical of $n$, $rad(n)$, is the product of distinct prime factors of $n$. For example, $504 = 2^3 × 3^2 × 7$, so $rad(504) = 2 × 3 × 7 = 42$. ...
57 views

### Equivalent passwords ACPC 2014

I am preparing for ACM-TCPC (Tunisia). So I started solving problems from past ACM-ACPC versions. But I got stuck in the Problem I from 2014. The problem consists of finding the number of ...
43 views

### Segmented Sieve of Eratosthenes in Scala

I'm trying to solve PRIME1 in SPOJ with the following Scala snippet: Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between ...
46 views

### PE # 34 - “Digit Factorials” with no loops

I posted a similar question “Curious Numbers” (HackerRank PE 34) recently (but in a different language/platform altogether). I'm starting to learn JavaScript and decided to take the challenge again ...
240 views

### Pizza Hut math problem #1 in Haskell

I'm currently attempting to learn Haskell after a fair history of imperative programming. When I saw the Pizza Hut Pi Day math problems, I thought the first one would be a good candidate for my ...
93 views

### Chess board in JS

I've completed the small challenge in the eloquent JS book to create a chess board pattern: Write a program that creates a string that represents an 8×8 grid, using newline characters to ...
77 views

### Google Code Jam: Store Credit Java Solution

It would be great if I could get this code reviewed. I would love tips on how I could improve my code. Problem You receive a credit C at a local store and would like to buy two items. You ...
97 views

### Lazy prime number generator

There are multiple Project Euler problems (e.g. 7, 10) that deal with prime numbers. I decided make a reusable solution that could be used for most of them. I wrote a method to generate an infinite* ...
59 views

### CS50 pset-1 itsa Mario - make a half-pyramid using parameters from user input

I'm taking Harvard's introduction to computer science (CS50) course online, and I've written a program that satisfies a coding challenge but I don't understand what I did or how I can improve it. I'm ...
78 views

### “Curious Numbers” (HackerRank PE 34)

I was inspired by a certain recent question to try my hand at this challenge: Project Euler #34: Digit factorials $19!$ is a curious number, as $1!+9!=1+362880=362881$ is divisible by ...