All Questions
-2
votes
0answers
24 views
Pass Javascript Variables To CSS [on hold]
I am attempting to pass multiple javascript variables to css. I have found a way to pass a single variable:
var i=128;
while (i--){
document.write("<div id='divtoresize'></div>");
...
3
votes
2answers
46 views
Find a set of maximal matching edges
Consider a connected undirected graph. A matching set of edges on this graph is defined as a set of edges such that no two edges in the set share a common vertex. For example, the left figure denotes ...
8
votes
9answers
374 views
Seventy Seven Sevens
Given a number n and an upper limit l list the numbers that can be created by multiplying two or more numbers consisting of only sevens of length n or less that are less than l. A161145 is close to ...
3
votes
0answers
67 views
Golf this AP CS Java FRQ - Duplicate Sums of Arrays in 2D Array [on hold]
In preparation for the AP Computer Science AP Test (Java), our teacher has been giving us FRQs from previous years for practice.
My friend and I were golfing this during class today and got it as ...
9
votes
3answers
121 views
Find the number of subgroups of a finite group
Definitions
You can skip this part if you already know the definitions of groups, finite groups, and subgroups.
Groups
In abstract algebra, a group is a tuple (G, ∗), where G is a set and &...
26
votes
18answers
1k views
Factorials and never ending cycles!
As you may know it, the factorial of a positive integer n is the product of all the positive integers which are equal or smaller to n.
For instance :
6! = 6*5*4*3*2*1 = 720
0! = 1
We will now ...
14
votes
2answers
282 views
Snooker scoring
I was watching the world snooker championship and it got me wondering..
Snooker scoring
In the game of snooker there are certain rules that you must adhere too:
When there are red balls on the ...
1
vote
0answers
48 views
Rewrite the Tiny BASIC IL program to support 7 changes to BASIC [on hold]
Circa 1976. With the success of the Tiny BASIC Design Note, a variety of Tiny BASIC IL implementations now span a range of microcomputers. The time has come to expand the Tiny BASIC standard.
Grammar ...
17
votes
29answers
2k views
Get a random n digit number with distinct digits and first not a 0
I read this question and thought it would make a nice challenge.
Task
Give an input 0<n<10 generate a random number with
exactly n digits
the first not a 0
so f(n)>10**(n-1)-1
distinct ...
7
votes
9answers
207 views
Largest Increasing Subsequence [on hold]
We define an increasing string as one that has characters in increasing order i.e. a0a1a2 a has a0<a1<a2<a3..<an. You are given an input string which might not satisfy this property, so ...
-1
votes
0answers
61 views
Let's make a tennis game! [on hold]
All of a sudden I really want to play a game of tennis!
This is where you guys come in.
You have to print a tennis game, but it has to be in C#
Data requirements
A game has one of the following ...
16
votes
2answers
186 views
Team of The Hill!
This challenge was inspired by @HelkaHomba's excellent challenge Red vs. Blue - Pixel Team Battlebots. That challenge was probably the best one I've seen on this site. Ever.
My challenge is still a ...
-3
votes
0answers
39 views
Challenge: Array Math [on hold]
//PART 1 IS FINE, PART 2 IS WHERE MY PROBLEM IS
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
public class JamesWay_Java_Assignment4
{
public static void main(...
27
votes
5answers
2k views
Fake Statistics
If you're going to invent some fake news, you'll want to fabricate some data to back it up. You must already have some preconceived conclusions and you want some statistics to strengthen the argument ...
19
votes
8answers
2k views
Un-average temperatures!
There was a discussion going on in TNB once about the best temperature scale, and we agreed on something: Take the average of all four main temperature scales! That is, Celsius, Kelvin, Fahrenheit, ...
16
votes
16answers
1k views
Get the decimal!
Task:
Your task is, when given three inputs:
a numerator n
a denominator d
another integer, x
Create a program/function that finds the xth digit of the number after the decimal place.
Specs:
The ...
25
votes
11answers
3k views
Perfect Palindromes
Your task is to determine how much of a perfect palindrome a string is. Your typical palindrome (eg 12321) is a perfect palindrome; its perfectness is 1.
To determine the perfectness of a string, you ...
-5
votes
0answers
48 views
C Program By Using aFunction [on hold]
Write a C function that take two strings (array of characters) and return one if the 1st is part of the 2nd and zero otherwise.
Sample Input
hello
helloworld
Sample Output
1
17
votes
13answers
2k views
Create a simple line editor
In: a string without line breaks*
Allow the user to edit and submit the line
Out: the modified string (optionally with a trailing linebreak)
The line editor must at minimum allow the user to:
move a ...
11
votes
6answers
591 views
Backwards and forwards polyglot quine!
You must make a polyglot that outputs its source code in one language and its source code backward in another. Unlike the normal rules, you are allowed to read the current file or use a builtin to get ...
5
votes
0answers
81 views
Challenge Similarity Detector
Challenge
Given two question IDs, try to figure out how similar they are by looking at the answers.
Details
You will be given two question IDs for codegolf.stackexchange.com; you may assume that ...
18
votes
7answers
738 views
Reverse and add degeneracy
Intro
Reverse and add is as simple as it sounds, take n and add it to its digits in reverse order. (e.g. 234 + 432 = 666).
If you apply this process repeatedly some numbers will eventually hit a ...
6
votes
2answers
140 views
Tips for golfing in SOGL
Do you have any code-golf tips for writing in SOGL, a golfing language created by dzaima?
Your tips should be at least somewhat specific to SOGL.
Please post one tip per answer.
11
votes
9answers
2k views
Google Autocomplete Fun
Your task is to create a program which, given an input string, will output the first Google autocomplete result for that search. The format of input/output is up to you.
Rules
Your program must ...
19
votes
2answers
397 views
The Image of the Dragon
I saw a cool gif of the twin dragon curve made from a square, and wondered what would happen if we started from another base image. So I wrote a program to do this.
&...
17
votes
7answers
1k views
Hexagonal Triangles!
Your task: make a hexagonal triangle with side length n, where n is a positive whole number or 0.
First, let me define a hexagon:
/ \
| |
\ /
(Amazing ASCII art, right?)
Hexagons can be linked ...
-1
votes
0answers
28 views
adder in logisim on logic layer only with 2-input-nand gates [on hold]
I want to build an adder in logisim only with 2-input-NAND gates.
The adder consists of 2 inputs (1 x constant 1 and 1 x arbitrary number) and an output.
The first thing which came into my mind is a ...
-5
votes
6answers
198 views
Hello… eh, who?
Introduction
You started to write a "Hello, World!" program, but after you wrote the part to print the hello, you forgot what your program should actually print. So now, you somehow managed it to ...
-1
votes
0answers
87 views
4 to 1 multiplexor on logic layer in logisim [on hold]
I want to substitute a 4 to 1 multiplexor in logisim which should consist only out of logic gates. I already have the substitution but something does not work with the connection.
I got a single wire ...
-4
votes
0answers
36 views
weddingriddle unsolved opening a box with 8 numbers as answer [on hold]
If 2+2 = 4
and 4+2 = 3
because 3+1 = ?
we tried using the numbers that are written, a more lettered solution, couting things, logic thinking,...
6
votes
0answers
166 views
Golf an unbeatable chopsticks bot
From Wikipedia:
Chopsticks is a hand game for two players, in which players extend a number of fingers from each hand and transfer those scores by taking turns to tap one hand against another.
In ...
0
votes
0answers
113 views
ASCII Art :Get a letter (A-Z) from its graphical representation [on hold]
How can I get a character (A-Z) from string which contains its graphical representation ?
for example, if I am using 3x5 letters, graphical representation for letter 'A' will be :
#
# #
###
# #
# #
...
17
votes
8answers
809 views
Garbled Phone Numbers
You know how you get a voicemail message and the person's connection wasn't great, and you're trying to figure out how to call them back, but you're not sure if that was a "5" or an "8" they said?
...
1
vote
0answers
79 views
Optimal rotation for broken touchscreen [on hold]
Background:
Okay, i dropped my android smartphone and damaged the touchscreen
The lower half (yeah, exact half!) is spider-webbed and does not work (potrait-mode)
Fortunately for me, the display ...
5
votes
11answers
294 views
Cheapo Enigma machine (Robbers)
For cops' post, Cheapo Enigma machine (Cops)
A robber's submission consists of a program/function that accepts the output of a cop's code and returns the input for all the outputs provided by that ...
6
votes
8answers
471 views
+50
Cheapo Enigma machine (Cops)
For robbers' post, Cheapo Enigma machine (Robbers)
A cop's submission will consist of a program/function that accepts a single byte of data and return a single byte of data. Every possible input must ...
11
votes
5answers
197 views
Find a User's SE Reputation
Challenge
Given a SE user's ID, output the sum of their reputation from across all of the Stack Exchange networks the user has signed up to.
Rules
If a user has 101 or less reputation on a site, ...
-2
votes
0answers
65 views
Correct the following c++ program about fibonnaci number [on hold]
#include<iostream.h>
#include<conio.h>
int fibbonacci(int n);//This is a function prototype
int main()
{
int n;
cout<<"\n\nEnter the Number of terms upto which we want ...
13
votes
7answers
364 views
Grow Some Flowers!
Spring has recently arrived, and it is almost the time when flowers start to sprout. So I want you to help them grow.
Your task:
Given two numbers, m, and n, output m flowers randomly placed on an n*...
6
votes
0answers
89 views
Tips for golfing in Charcoal
Charcoal is a language created by ASCII-Only that specialises in ASCII art challenges.
What tips do you have for golfing in Charcoal? Obviously I am looking for tips related specifically to Charcoal, ...
22
votes
9answers
806 views
Ants on a Natural Log
This is a good beginner challenge and a good time killer.
I only said a -natural- log because the title was too short, this has nothing to do with logarithms.
Given 2 variables:
The number of ants ...
8
votes
3answers
197 views
Transpile these ES6 arrow functions!
The ECMAScript 6 standard added many new features to the JavaScript language, including a new arrow function notation.
Your task is to write a basic ES6-to-ES5 transpiler. Given only an ES6 arrow ...
18
votes
23answers
2k views
Row, row, row your boat
Everyone is likely familiar with the following song, which is a musical round:
Background
Fewer people might recall trying to sing the 4-person version of this with a few friends and failing. ...
22
votes
10answers
2k views
Braille-ify a string
And no, This is not a dupe of Translate ASCII text to braille.
There are 28=256 Braille patterns in Unicode. (By 'Braille' I mean 8-cell ones)
W, wait. How many ASCII characters were there?
27 = ...
16
votes
9answers
2k views
Palindromic Primes without 11
Every palindrome with an even number of digits is divisible by 11, so 11 is the only [palindromic prime] with an even number of digits. - David Wasserman, OEIS
I learned this today the manual way, ...
16
votes
8answers
1k views
Connect Four Validator
Introduction
Connect Four is a game where you attempt to get four in a row: horizontally, vertically, or diagonally. In this code golf, we will be trying to find who won, given a game board. There ...
-5
votes
13answers
173 views
Finding the center point between two points on a plane [closed]
Challenge:
To take two points on a plane and figure out the position of the point that would be between them with an equal distance to each of the original points.
Example:
(0,0), (3,3) -> (1.5,...
46
votes
22answers
5k views
Create a Paint program!
Introduction
One day, you were showing your kid how to draw on a computer. You type mspaint.exe in the run bar. To your horror, it says "No items match your search". You must create a simple version ...
16
votes
22answers
1k views
Count occurences of a set in a list
Given a non-empty set of strings and a list of strings, find out how many times the set occurs in the list, i.e. how many times you could create the set with items from the list. Every element from ...
-5
votes
12answers
97 views
Restricted powers of two [closed]
Challenge
Given a number x, output the first x powers of two, starting with 2¹ (2).
Example
2 2 4
3 2 4 8
1 2
6 2 4 8 16 32 64
You may output numbers separated by non-numerical characters....