[职通车]上海交大科研团队穿西装种草莓
14,425 questions
6
votes
2
answers
40
views
Squaring the roots of a polynomial
In this challenge, you are given a polynomial \$p(x)\$, and you need to find a polynomial \$q(x)\$ whose roots are exactly the squares of the roots of \$p(x)\$ (counted with multiplicity). In other ...
18
votes
9
answers
905
views
What's left after repeatedly removing palindromes
Sometimes a string has buried palindromes in it:
hallolilah contains lol.
And if we took out ...
14
votes
4
answers
803
views
Identify Last-Layer Perm of a Rubik's Cube
A popular method for solving Rubik's cube consists of:
solving its first two layers, by convention starting with the white side
orienting the last layer's pieces so they face the same direction with ...
1
vote
1
answer
230
views
The Parable of the Dagger Prelude
Taken from lesswrong.com
Once upon a time, there was a court jester who dabbled in logic.
The jester presented the king with two boxes. Upon the first box was
inscribed:
"Either this box ...
-4
votes
3
answers
191
views
Print Today's Motto [closed]
Motto of the day (MOTD) or Today's Motto is a algorithm to generate a unique & dynamic motto for every day.
Input of the date to calculate motto for could be in any reasonable format. The program ...
18
votes
7
answers
2k
views
Seven-dimensional cross product
The cross product is a peculiarly 3-dimensional phenomenon. There are multiple ways of generalizing it, but each of them have trade offs.
If you require that a cross product be a product of two ...
23
votes
15
answers
2k
views
Write two very different programs with the same characters
Your task is to write two programs/functions, in the same language.
Program 1: Verify that two inputs are anagrams of each other.
Program 2: Verify that two inputs differ from each other at every ...
6
votes
14
answers
1k
views
Make a Mulenère encryption program
Mulenère cipher is a version of Vigenère ciphers, which uses multiplication instead of addition.
Algorithm
It's simple. First, the password will repeated as much as reach a size bigger than length of ...
2
votes
1
answer
146
views
Unstablizable LaTeX [closed]
from Latexmk:
If you use cross-references, you often have to run LaTeX more than once ...
Sometimes cross-referenced location changed and you need to run LaTeX again to create the correct reference. ...
16
votes
8
answers
1k
views
Output shortest string containing all input strings
Given a list of words (letters only) in no particular order, output the shortest string containing every word (disregarding case). Output must be lowercase, except the first letter of each word is ...
2
votes
13
answers
534
views
List of prime distances
Task:
Write a code golf program that, given two positive integers n and m, returns a list of the distances between consecutive prime numbers in the range [n, m] ...
34
votes
8
answers
4k
views
Rig The Lottery, but Don't Get Caught
Edit: Please note there is currently a vote to close this coding challenge due to a complaint that it may be technically violating a decade old rule for this site. There is currently a discussion in ...
24
votes
6
answers
2k
views
Computing Pi with iF*ck
Objective
Compute \$\pi\$ using nothing but \$i\$ (\$\sqrt{-1}\$).
Guidelines
ONLY exponentiation and multiplication may be used (i.e. \$i^i\$ or \$ii\$)
No additional symbols may be used (so no ...
16
votes
12
answers
2k
views
Who was leading the race?
Your goal is to find out the order of the drivers in a race (1st, 2nd, 3rd, etc) each time the start / finish line is crossed. This would allow someone to see the progression of a driver throughout ...
12
votes
3
answers
2k
views
The shortest NP-complete problem
Find an NP-complete problem that covers all finite ASCII strings, and present a solver for the problem in the programming language of your choice.
By the definition, if there is a finite ASCII string ...