@ShieruAsakoto In relation to Nathan Merrill's comments: While I understand restricting it to a specific language, and while JS is widely written, the subset of people who: write JS, have the time to write complicated things in JS, and can understand the challenge - will be fairly limited. You're likely to get some low-effort just-qualifying submissions and only a few more interesting ones.
@ShieruAsakoto That's a good idea. That way people can read more if they want to understand it, but spend less time before being able to start on a solution.
Background
Variable declaration statement in C consists of three parts: the name of the variable, its base type, and the type modifier(s).
There are three kinds of type modifiers:
Pointer * (prefix)
Array [N] (postfix)
Function () (postfix)
You can specify a list of function arguments insid...
I devised a quick-and-dirty method for measuring how popular a language currently is on PPCG. Search is:a language-name, sort by Newest, scroll to the bottom, select 50 results per page, and check the date of the 50th-newest answer.
Pros: easy to do, doesn't require special privileges. Cons: prone to false positives, doesn't work well for single-character or symbolic language names.
Some current results:
Python: Oct 20
JavaScript: Oct 13
Jelly: Oct 7
APL: Oct 5
05AB1E: Oct 2
PowerShell: Oct 2
Ruby: Oct 1
Java: Sep 20
PHP: Sep 13
Pyth: Sep 7
Retina: Aug 25
Stax: Aug 17
MATL: Aug 8
Julia: Jul 5
MATLAB: Jun 11
CJam: May 17
Befunge: Apr 7
QBasic: Mar 12
@Downgoat If a bounty is awarded by the Community user, it means that it was defaultly awarded to the highest voted answer, and not awarded by the person who set the bounty
Hack g-code parser
Here you can see g-code parser, written in JavaScript to use in microcontoller(like espruino). But you can run it in browser, because it don't use any specific features
function gcode(str){
//Removes comment, parses command name and args
const [,f,args] = (str.match(/...
It's essentially code-golf in a minimalist programming language. If anyone here can solve the puzzles I linked to in that room, could you share or hint? I can't figure out what I'm missing.
Is this number secretly Fibonacci?
I can't think of a good name for this challenge, so let me know if you think of anything.
Most of you know what a Fibonacci number is. Some of you may know that all positive integers can be represented as a sum of one or more Fibonacci numbers, according to th...
Summary
Given I have two lists with binary values of equal length=>3, return a pair with an identical sum, but with minimal forward difference.
Forward difference [1] being the absolute difference between items. For example:
[0, 1, 0] would be sum(abs([1, -1])) => 2
[1, 1, 1] would be sum(abs...
fastest-code is also going to be very difficult to judge with the challenge as-is. All of the test cases are small enough that they would complete within milliseconds; well within error margins.
Actually, I think the problems may go deeper than this... I have to go offline and do some thinking. I'm going to delete the question and get back to you.
Oh I mist sum(list_a) + sum(list_b) == sum(smoothed_a) + sum(smoothed_b)
*missed
@Seanny123 FWIW, I think if you removed list_a[i] + list_b[i] <= 1 and made it about elementwise sums, it would be very interesting
With the way it is now, you just want to sort the two lists so all the 0s and 1s are grouped together, which is fairly easy. If you have to make sure the elementwise sums of the new lists are the same, that becomes more challenging
Yeah, I forgot the contraint wherein the only valid operations are swaps, like list_a[i] = list_b[i] and list_b[i] and list_a[i]. Which no longer makes this an interesting question, so I think I'll post it on codereview.stackexchange.com
Gah, making internal assumptions explicit is not something I am well practiced in.
CMC (inspired by Seanny's challenge): Given an array of arrays of integers, where each sub-array may have a different length, rearrange the integers so that the absolute sum of the consecutive differences of each sublist is as small as possible.
Well the binary doesn't matter as much as the fact that sublists could have length 1. And also that the differences between the end of one sublist and the start of the next aren't relevant.
Split it. But not all!
code-golfstring
Inspired by this StackOverflow question.
Input:
We'll take three inputs:
A delimiter-character D to split on
A character I within we ignore the character to split on (I know, that sounds vague, but I'll explain it below)
A string S
Output:
A list/ar...
Given a program in your language, generate another program that do exactly the same thing so every bytes in it are prime.
Shortest generator in every language win. No acception.
Nop in languages that only allow prime bytes are legit, but just don't post them(or make a community answer to put t...
The premise of this is simple: A 10% chance is pretty unlikely, but everyone knows that a one-in-a-million chance is a sure thing!
So, write code that implements the following "dramatic" probability rules:
Take in a floating point P from 0 to 1 representing the unmodified chance of some plot-r...
The non-negative integers are bored of always having the same two* neighbours, so they decide to mix things up a little. However, they are also lazy and want to stay as close as possible to their original position.
They come up with the following algorithm:
The first element is 0.
The \$n^{th...
My birthday is in a month, and this is a slice of tasty cake.
.-""-.
.-" "-.
|""--.. "-.
| ""--.. "-.
|""--.. ""--..\
| ""--.. |
| ""--..|
""--.. |
""--.. |
""--..|
In the fewest number of bytes, con...
CMC: Given two of the unit vectors corresponding to the Ox, Oy, Oz, -Ox, -Oy and -Oz axes, namely i, j, k, -i, -j and -k, return their cross product. Test cases: (i, j) -> k; (j, i) -> -k; (k, i) -> j; (i, k) -> -j; (j, k) -> i; (k, j) -> -i; (-j, i) -> k; (-j, -i) -> -k (note the anti-commutativity)
I have a formula that I wish to transform its results to a range of 0 - 100; 'so no matter what data is entered, it always falls between those bounds'
t = current time
b = start value
c = change in value
d = duration
-c * (Math.sqrt(1 - (t/=d)*t) - 1) + b
The input values will be lineal, and ...
I have created an encoding method called the "foo" encoding. It uses a special algorithm that I created to encode any string into an encoded string that uses the keywords foo, bar, baz, fo, br, and bz.
Let's say I input the following into the program:
Noodle pie is delicious.
I will get th...