All Questions
0
votes
0answers
3 views
Check if computer is connected to the internet
Write a program which, returns or prints "true" or "false", as either a string, int (1 = true), or bool, according to whether the script has access to the internet. It must be a standalone program or ...
4
votes
0answers
57 views
Sushi Man, make me some sushi
It's lunch time, I am hungry and I came to your Sushi Bar. You are the Sushi Man and you have to produce a full program or function to make me some sushi!
Credits: Wikipedia
Disclaimer: The image ...
0
votes
0answers
42 views
Find equal pairs [on hold]
Problem
Given an array A of unique integers, find the index of values that
satisfy A + B =C + D, where A,B,C & D are integers values in the
array. Find all combinations of quadruples.
I ...
-3
votes
0answers
23 views
How to insert all the values from Listbox to datagridview [on hold]
i was trying to save all the values/text(not the selected one but all of the values on it) in the listbox to datagridview
like this:
here's my code for saving to datagridview
Data.con.Open();
...
20
votes
24answers
2k views
zero zero zero zero zero zero
Given an integer n > 0, output the length of the longest contiguous sequence of 0 or 1 in its binary representation.
Examples
6 is written 110 in binary; the longest sequence is 11, so we
should ...
7
votes
5answers
228 views
Converting Numbers to a “Not quite place-value system”
Lets create a system of numbers where the biggest digit in the nth place value (counting from right to left) of a number length m is always equal to m - n + 1. To give an example the largest 5 digit ...
8
votes
8answers
163 views
All squares that match a wildcard sequence
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 asterisks. A string matches this ...
-2
votes
0answers
88 views
Why is this extremely user unfriendly captcha, and how to SOLVE it? [on hold]
I wanted to register at a (reasonably popular!) forum, and in the registration form, I got the following 'Captcha' challenge to solve...
int i = 2;
int h = "ZNC".hashCode() % 3000;
int t = "WMN"....
0
votes
0answers
48 views
Calculate PI to n digits [duplicate]
There have been many questions asking for variations on how to write Pi but none are like this...
EDIT: There are many questions asking for the nth digit of Pi, I am asking for UPTO the nth digit.
...
18
votes
3answers
585 views
Arranging Bubbles
Note, challenge copied from question asked at math.stackexchange.
Recently, I attained quite some skill at blowing bubbles. At first I would blow bubbles like this:
But then things started getting ...
18
votes
8answers
867 views
Symbolic matrix multiplication
There are lots of different ways to explain matrix multiplication. I'll stick with a single figure since I believe most people here are familiar with it (and the figure is very descriptive). If you ...
25
votes
32answers
3k views
Every word from babab to zyzyz
Your task is to write a program that will output a readable list of every five letter words with the structure:
consonant - vowel - consonant - vowel - consonant
The output should be sorted ...
1
vote
7answers
212 views
Make a string a e s t h e t i c [duplicate]
Basically, between every character of a uni-line string, add a space, but there can't be two spaces in between one character.
aesthetic becomes a e s t h e t i c.
The quick brown fox jumps over the ...
26
votes
3answers
311 views
Python workarounds for assignment in lambda
This is a tips question for golfing in Python.
In Python golfing, it's common for a submission to be a function defined as a lambda. For example,
f=lambda x:0**x or x*f(x-1)
computes the factorial ...
0
votes
0answers
81 views
Golf representations of numbers [on hold]
Background:
Almost all useful numbers in mathematics can be reached using only 7 different symbols:
e
-
^
(
)
ln
sin
Here are some simple examples of integers:
0 = e-e
1 = ln(e) (parenthesis are ...
49
votes
39answers
3k views
Score rock-paper-scissors
Given two string inputs of "Rock", "Paper", or "Scissors", determine the outcome of the RPS round. Output 1 if the first player wins, -1 if the second player wins, or 0 for a tie.
Rock Rock -> 0
...
-6
votes
0answers
58 views
Need help on python 3x on creating an input string that gives a true or false output [on hold]
Each single digit from 0-9 is valid.
two or more digits are valid as long as it doesn't start with 0.
x+y x-y x/y x*y are valid expressions
Nothing else is a valid expression
Hints on how to do it ...
-4
votes
0answers
60 views
Translate WSF to Brainfuck [duplicate]
Challenge
Translate the WSF programming language to BF code.
Syntax
All sequences of whitespace are interpreted as trits (ternary digits) with all other characters ignored/removed. The translation ...
14
votes
4answers
225 views
Convert between balanced bases!
Balanced bases:
Balanced bases are essentially the same as normal bases, except that digits can be positive or negative, while in normal bases digits can only be positive.
From here on, balanced ...
40
votes
19answers
7k views
Hack the elections
You're a professional hacker and your boss has just ordered you to help a candidate win an upcoming election. Your task is to alter the voting machines data to boost the candidate's results.
Voting ...
-1
votes
1answer
118 views
Find an Eulerian Circuit
Challenge
You have been assigned a task to write a program which takes a multigraph as its input and if it contains an Eularian circuit to return one. Otherwise, the program's behavior is undefined, ...
28
votes
25answers
2k views
Sort a string, sort of
If you sort a string you'll typically get something like:
':Iaaceeefggghiiiiklllllmnnooooprrssstttttuuyyyy
Yes, that was the first sentence sorted.
As you can see, there are a lot of ...
27
votes
15answers
1k views
Is it an OVSF code?
Given a list of 1s and -1s, determine whether or not it is a valid OVSF code (by outputting a truthy or falsey value).
OVSF codes are defined as follows:
[1] is an OVSF code.
If X is an OVSF code, ...
0
votes
0answers
57 views
Easy Square Encoder [duplicate]
There is quite a basic way of "encoding" a piece of text so that it can be easily decrypted but still looks quite difficult. This is called square encoding.
The way that one square encodes a piece of ...
14
votes
1answer
189 views
Obfuscated Integer Notation
Edit: I will be posting a newer version of this question on meta-golf soon. Stay tooned!
Edit #2: I will no longer be updating the challenge, but will leave it open. The meta-golf version is ...
10
votes
10answers
364 views
Smallest Multiple to “Palindromize” [duplicate]
Goal:
Given any non-zero natural number a, find the smallest non-zero natural
number b such that a•b is palindromic, e.g. it reads the same forwards and backwards. Input a through any reasonable ...
38
votes
13answers
2k views
Zero sum covers
Introduction
Consider a nonempty list L of integers.
A zero-sum slice of L is a contiguous subsequence of L whose sum equals 0.
For example, [1, -3, 2] is a zero-sum slice of [-2, 4, 1, -3, 2, 2, -1, ...
19
votes
2answers
317 views
Solve an Ice Maze
Ice mazes have been one of my favorite staples of Pokémon games since their debut in Pokémon Gold and Silver. Your task will be to make a program that solves these types of problems.
Ice mazes ...
-2
votes
0answers
78 views
Write a /(meta-)*Quine/ [duplicate]
Okay, fine it's a /(?:meta-)*quine/
So what is a Meta-Quine?
Quine: program which outputs its own source code.
Meta-Quine: Program which takes no input and outputs a quine.
Meta-meta-quine: Program ...
-3
votes
0answers
61 views
FindFirstAndLastArrayList [on hold]
Write a program that will store names. Prompt the user to enter 5 names into the list. Prompt
the user to enter a "key" value to search for in the list.
*Write a method that will accept an ...
36
votes
7answers
2k views
Sharing (characters) is Caring!
Consider the following task:
Given a positive integer n > 0, output its integer root. The integer root of a number n is the largest value of x where x2 ≤ n, usually expressed with the formula floor(...
21
votes
14answers
1k 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 the character in the string as an x coordinate and the ascii value as a y ...
19
votes
6answers
1k views
Count the squares
Challenge
Origami (folding paper) is a creative form of art. As far as I know, master of Origami prefers square paper. Let's start from beginning - convert a rectangular paper to a square one.
So ...
-5
votes
4answers
184 views
Converting floating numbers to string [on hold]
Task
Convert input point integer to string
Using format or other helpers is not allowed.
You need to write it's from scratch.
Data types
Output must be array of chars
Example in\out
Input: float ...
-4
votes
43answers
1k views
Multiply two numbers
Input: Two decimal integers. These can be given to the code in standard input, as arguments to the program or function, or as a list.
Output: Their product, as a decimal integer. For example, the ...
3
votes
0answers
126 views
Unpixellate an image [on hold]
When you resize an image down to a very small size, it looks very blocky when you scale the pixels back up individually.
In extreme cases, as above, you can no longer reconstruct the original image, ...
26
votes
35answers
2k views
Compute the Median
Challenge
Given a nonempty list of real numbers, compute its median.
Definitions
The median is computed as follows: First sort the list,
if the number of entries is odd, the median is the value in ...
-1
votes
0answers
35 views
Quadratic residues and non residues -matlab-code [on hold]
I need help to create matlab code to test and find a( quadratic residues and non residues) to this numbers found in table attached with my question from Wikipedia....... Thank you
35
votes
11answers
1k views
Different tasks, same characters
In this challenge, you need to solve 4 different tasks using the same set of characters. You can rearrange the characters, but you can't add or remove characters.
The winner will be the submission ...
-1
votes
0answers
40 views
Understanding Recursion using flow of control through recursion calls for Merge Sort [on hold]
I am studying the flow of control using recursion in Merge Sort.
The particular algorithm I used is:
MergeS(ar, p, r){
1. if p<r{
2. k = floor[(p+r)/2]
3. MergeS(ar, p , k)
4. ...
-2
votes
0answers
94 views
Find the nth digit of Pau [on hold]
Related: Find the nth decimal of pi
Overview:
"Pau" is a number defined as a 1.5 * pi coined by XKCD artist Randall Munroe (see comic).
Given a natural number n such that 0 < n < 64 through a ...
64
votes
41answers
9k views
Detect MS Windows
Yes it is exactly what you think.
Challenge
Create a program that returns a truthy value when run on Microsoft Windows (for simplicity we'll stick with Windows 7, 8.1 and 10) and a falsey value when ...
-3
votes
1answer
131 views
Output a random OEIS sequence
Your challenge: Connect to the Online Encyclopedia of Integer Sequences OEIS.org, access any random valid sequence, output it's ID, and ouput all of the members of the sequence provided by the OEIS ...
28
votes
9answers
2k views
Detect ASCII-art windows made of M and S characters
A Window is an ASCII-art square with odd side length of at least 3, with a single character border around the edge as well as vertical and horizontal strokes in the middle:
#######
# # #
# # #
###...
35
votes
5answers
3k views
Pi == 3.2
Inspired by this video of Infinite Series.
Introduction
Pi is defined as the ratio of the circumference to the diameter of a circle. But how is a circle defined? Usually a circle is defined as the ...
13
votes
10answers
673 views
Kids shuffling cards
Shuffling a deck of cards is hard for kids, so they must figure out ways to get a reasonable well shuffled deck as simply as possible.
One way to do this that gives reasonably good results is:
Take ...
13
votes
7answers
670 views
Parking lot supervisor
Introduction
You are a supervisor of a parking lot and your manager is preparing for shrinking the size to the extreme.
It is a simplified and adapted version of a problem in last year's PAT top-...
15
votes
21answers
977 views
Recreate the ASCII-table as an ASCII-table
Frequently while I'm code-golfing, I'll want to know what the ASCII value of a certain character is. One of my favorite resources for quickly looking up all of the printable ASCII characters is ...
16
votes
11answers
843 views
Output N in base -10
Challenge:
In the programming language of your choice, accept an integer as input in base 10, and output it in the negadecimal notation, which is also known as base -10
Example algorithm:
This is ...
7
votes
2answers
152 views
Combinatory Conundrum!
Introduction: Combinatory Logic
Combinatory logic (CL) is based off of things called combinators, which are basically functions. There are two basic "built-in" combinators, S and K, which will be ...