All Questions

Tagged with
6
votes
5answers
294 views

Generate the k-ary necklaces of length n

The set of necklaces is the set of strings, where two strings are considered to be the same necklace if you can rotate one into the other. Your program will take nonnegative integers ...
0
votes
1answer
118 views

Symmetric Numbers [duplicate]

write a function to tell if a number is symmetric or not. for example: input: 151 output: True input: 142 output: False and so on: 1111 True, 2390 False, 1226221 True
5
votes
17answers
842 views

Solve for N from input string

Challenge : Your job is to find the given number N. Input : You will be given a string in the following form: dN ± Y = X ...
-6
votes
20answers
587 views

XOR reduction bools

Description : Given a string of space separated binary digits or space separated booleans or an array of binary digits or array of booleans . Your job is to find the xor of each until you end up with ...
5
votes
1answer
335 views

Conway's game of life [duplicate]

Description : Given an array of strings representing a grid of cells With the key : 0 = 'dead cell' 1 = 'live cell' write a function that returns the next ...
-6
votes
7answers
214 views

Convert phones to calculation [closed]

Introduction OnePlus is a Chinese smartphone manufacturer founded in December 2013. Their latest phone, OnePlus 5, was unveiled on June 20, 2017. I am sure you have seen that the name of the phone ...
17
votes
12answers
2k views

There's no such thing as a free lunch

...or is there? Your challenge is to parse my lunch bill, which contains the base price, tips, discounts, coupons, and extras and find out if my lunch was $0 or less. If this is the input: ...
175
votes
47answers
28k views

Mathematics is fact. Programming is not

In mathematics an exclamation mark ! often means factorial and it comes after the argument. In programming an exclamation mark !...
36
votes
18answers
5k views

Automate your first grade counting exercise

CodeGolf Challenge PWSSHHHH! You wake up in a cryogenics lab in the year 3000. Upon being escorted to the assignment office to receive your career chip, presumably that of a delivery boy, a probe ...
9
votes
11answers
354 views

All squares that match a wildcard sequence [closed]

This was inspired by part of the 2016 ARML competition Team Problem #6. Here's the challenge: You're given a "wildcard sequence", which is a sequence of digits and another character. A string ...
25
votes
15answers
2k views

Linear Regression on a String

This challenge is a little tricky, but rather simple, given a string s: meta.codegolf.stackexchange.com Use the position of ...
12
votes
3answers
355 views

Natural Pi #2 - River

Goal Given an string with a train of hashes, calculate its total length and divide by the distance from start to finish. Simulation What are we simulating? According to this paper, the ratio of the ...
34
votes
29answers
2k views

Crazy 8s Code Golf

Create a program that prints all whole numbers inclusively between an interval (a, b), and replaces multiples of 8 in the sequence with random (uniformly ...
10
votes
5answers
2k views

How many significant figures?

Given a number as input, determine how many significant figures it has. This number will should be taken as a string because you have to do some special formatting. You'll see what I mean soon (I ...
5
votes
2answers
296 views

String Calculator

Assume you're writing in one method, (or whatever you call them) with 3 inputs: the first string, a character that contains a +, ...
42
votes
29answers
3k views

Bitflip and negate

Given an integer, make an expression that produces it from 0 using unary negation - and bitwise complement ...
23
votes
4answers
538 views

Teach me how to add! [duplicate]

Everyone knows how to add numbers by hand, right?––Well, I hope so, but for anyone who needs a quick reminder: To add 17282 and ...
17
votes
8answers
1k views

Find numbers within the Copeland–Erdős constant

Background The Copeland–Erdős constant is the concatenation of "0." with the base 10 representations of the prime numbers in order. Its value is ...
16
votes
2answers
288 views

Normal sentences

Write a program or function which, given an input string and a standard deviation σ, outputs that string along the normal distribution curve with mean ...
14
votes
11answers
2k views

I only pay with dollars

As the title -- although discretely -- hints, I only pay with dollars. The challenge Write a function/program that takes a string as input, which is a monetary value preceded by a symbol. ...
38
votes
19answers
3k views

Print the nth prime that contains n

This question will be a twist on finding the nth prime number. Challenge You must write a program that will take one input n, ...
12
votes
1answer
406 views

How many squares are there?

This challenge is inspired by a picture that often roams on Facebook that looks like this. Except our base square will look more like this: ...
43
votes
18answers
5k views

Universal Spooky Meme Translator

Introduction Turns out, aliens love memes just as much as we do. Every alien race we've encountered so far has their own version of 2spooky4me (see the following ...
5
votes
3answers
182 views

Taylor Series of a Function with Periodic Derivatives

Taylor series are a very useful tool in calculating values of analytic functions that cannot be expressed in terms of elementary functions, using only information about that function at a single point....
-5
votes
4answers
278 views

Solve an algebraic expression

The Challenge Your task is to create a program that can solve an algebraic equation. Input Input will consist of a String. The string will be an equality ...
12
votes
5answers
620 views

Efficient Scientific Notation

The other day my chemistry teacher was explaining to us about scientific notation (using a small number and multiplying it by powers of ten to express large numbers more easily), which brought me back ...
-6
votes
11answers
173 views

Hexadecimal of a character

Given a unicode character C (or the first character of a string input), output that character's hex representation. Case does not matter. The output ranges from <...
31
votes
6answers
1k views

Have you been nice this year?

Introduction Santa has too many names to process, and needs your help! He needs you to write a program or a function, which outputs nice, ...
5
votes
16answers
786 views

Average of a string [duplicate]

You have been employed by a data analysis company, and have been appointed the task of finding the average character of a string of characters. However, this company has limited funding for code ...
19
votes
5answers
1k views

The Interview: The Front Nine

The Interview: The Front Nine This is the first of a series of challenges inspired by programming job interview questions. You walk into the office where your potential future boss sits. "Come on in ...
9
votes
9answers
609 views

Love Tester Code Golf

Create program that counts the total number of letters common to two names, and finds the product of their lengths, to function as a "love tester." Conditions: you may not get a 1:1 answer (being 3 ...
10
votes
7answers
2k views

Base85 Encoding

The Challenge Write a program that can take an input of a single-line string containing any ASCII printable characters, and output the same string encoded in Base85 (using a big-endian convention). ...
20
votes
8answers
1k views

Crazy Librarian's Amazing Sorting System

It's back to school season! So for a part-time job, you're helping out at the school's library. The problem is, the head librarian has never even heard the words "Dewey Decimal," let alone implemented ...
37
votes
5answers
1k views

Overcoming cluster size

Fed up with the reliability of flash storage, you decided to store all your programs on one of those good old 1,440 KiB floppies. However, after copying not even 3,000 programs, the disk was full. How'...
20
votes
12answers
1k views

Symbolic Differentiation of Polynomials

Symbolic Differentiation 1: Gone Coefishin' Task Write a program that takes in a polynomial in x from stdin (1 < deg(p) < 128) and differentiates it. The input polynomial will be a string of ...
14
votes
3answers
881 views

Expression that equals its length

Given a number, find an expression in words equaling that number, with a length of that number. Thus, to an input of 15, you might output ...
14
votes
7answers
878 views

Molar masses of compounds

Task Write a program that takes in a compound made solely of elements with an atomic number less than or equal to 92 (Uranium), and outputs the molar mass of the compound in ...
15
votes
3answers
729 views

Find the shortest bracket numbers

Bracket numbers provide a simple way to express large integers using only left bracket, space, and right bracket ([ ]). A bracket number is defined as a string of ...
8
votes
10answers
2k views

Write an IBAN validator

Write a program (the body of the function is enough) that accepts a string of alphanumeric characters and validates it according to ISO 13616:2007. The algorithm for validation is (source: wikipedia ...
-7
votes
6answers
858 views

Code Golf: simple way to get min & max

You will take a set of input numbers, and output the minimum and maximum of the set. You can either write two programs, with 1 program doing each function, or one combined program. Here's an example ...