For some languages with a static type system the compiler is able to infer the types, however sometimes there's ambiguity (even with input) unless the user gives the type manually:
Motivation 1: Haskell
Consider the following Haskell example:
f xs = do
x <-randomRIO (toEnum 0, toEnum 1) --...
ghc is bigger than 2 GB, the butterflies cant address that far. so instead im just praying that a piece of toast falls from the ceiling with a copy on a hard disk
This is a code golf version of a similar question I asked on stack earlier but thought it'd be a good code-golf question.
Have a 10-length string starting from
0000000000
Iterate through till you get to
0000000009
Then start using letters in place to get 36 total iterators
000000000a
. ....
Locate Substring This is not a challenge yet, just a place to write down an idea. Given some finite binary string \$S\$, we can try to find the minimal length \$n \in \mathbb N\$ such that we can uniquely locate each contiguous substring \$ T \$ of \$ S \$ that has length \$ n \$. Example Let \$ S = 01000110 \$. Then surely \$ n > 1\$. But we also immediately see that \$ n > 2\$ b…
Assume that the method of generating the hidden test-cases is known. (for example: a list of 5000 uniformly random integers in range [1..1000])
Reasons why hidden test cases should be allowed (that I can think of):
Guaranteed to prevent hard-coding (assume that there are sufficiently many poss...
You need to check if a given number is even and then print 0, or it is a odd number and then print 1. The Number can have many digits.
So a challence is translate this program:
#include <iostream>
#include <string>
using namespace std;
int main() {
string a;
cin >> a;
if ( atoi( a.s...
Is my maze even solvable? code-golf maze Input A 2D array of booleans, which will be our maze. A truthy value will be a wall, and a falsy value will be a path. We start at the left upper corner, and end at the right down corner. Those two cells will always be a falsy value. Output A boolean value, which truthy means solvable, and falsy means not solvable. I/O Examples Input | Solu…
oh my god... In the script above, I call a function, it finds a list of pairs with regex, starts a loop and then passes them to a different function. When the program executes line by line in a debugger, it reaches the loop and then suddenly the function stops, like if there was a return inside, but there is only an assignment...
What the frick? It was caused by a call to .rtrim(":") on one of the groups...
oh wait. rtrim is undefined. why the hell there were no exceptions?
the thing is that the answer's ID is no longer in the proper URL, only as an ID reference (i.e. #<answer_id> ending of the URL, which is probably supposed to auto-scroll to the post, but no /<answer_id> anymore)
421 is a rather popular dice game in France and some other European countries. It is mostly played in bars and pubs to determine who's going to buy the next round of drinks. The full game is usually played in two rounds, with tokens that each player tries to get rid of, but this is irrelevant her...
What associativity was it again Tags: code-golf, balanced-string, parsing, parentheses, parsing, string Non-associative operators (for example the subtraction-operator) often are either left- or right associative, such that one has to write less parentheses. Consider for example the following: $$ a-b-c $$ Probably everybody read that as \$(a-b)-c\$, by default (usually) subtraction i…
So an extension of the typical basic DP question:
A NxN chess board, write code to calculate the number of ways you can go from the the top left to the bottom right corner, given that you can go down, up, left, AND right, and you can not revisit any cell.
N <= 100
I couldn't figure the exact...