Stackable sequences
You deal cards labeled 0 to 9 from a deck. When you deal a 0, you place it to start a new stack. When you deal any other card, you stack it atop a card that's exactly one lower in value, covering it. That way, each stack starts at 0 and counts up by 1. If you can't place the ...
> A lock is a private/public system where a physical public key is used to access the internal private mechanism(tumbler). When a user inserts a copy of the public key, they can gain access to the door and can modify it's internal states(like unlocking, and locking it).
there is a cool analogue of RSA that allows you to securely transfer the contents of a box from one person to another with just padlocks, without having to give away your key
alice puts the thing to transfer in a box, and locks the box with her padlock
she sends the box to bob, who also puts his padlock on the box (so now it's doubly locked), and sends the box back
alice removes her padlock, leaving just bob's padlock, and sends the box again
now bob can remove his padlock, and can open the box
^^ I got asked that by my maths teacher many years ago when I was bored in class. The only difference was that the box had a teddy bear and the postman was really evil
Yeah, I didn't get it at the time. I said "use a num-lock" to which she responded "if Bob has the patience the crack that, then so does the evil postman"
If you do want to send a lot of boxes though, you can send 1000 num-locked boxes, each of which just has a number and a long passcode inside. Bob picks one, cracks it, then tells Alice "I cracked number #n". Alice then sends the real box, with a mega-numlock where the code is the passcode Bob chose.
Why doesn't Alice just invite Bob over for tea and give him the bear in person? I mean, they're obviously good enough friends that they're exchanging teddy bears, maybe it's time they take the relationship to the next level.
@zyabin101 Alice takes a photograph of the teddy bear with a link to it on an e-Store and a gift card for that store steganographed over it, then RSA's the result and sends to Bob.
Golf K-means
K-means is a standard unsupervised clustering algorithm, which, given a set of "points" and a number of clusters K, will assign each "point" to one of K clusters.
Pseudo-Code of K-means
Note that there are many variants of K-means. You have to implement the algorithm I am describi...
@EᴀsᴛᴇʀʟʏIʀᴋ No, that repo contains the bot password and that's bad. Hackers can see the bot password on GitHub and log into the bot's account to spam the room. That's why the password must be sanitised.
@CᴏɴᴏʀO'Bʀɪᴇɴ according to my parents, even if you are not a stalker you are still a bad influence and thus so is code golf. My time here will be reduced for the next week.
Well, if you can make it interesting, with enough of a challenge to make it more difficult than a one-byte answer (which is what it would be in many esolangs), go ahead and Sandbox it up.
I want to try a new type of regex golf challenge, which asks you to solve nontrivial computational tasks with nothing but regex substitution. To make this more possible and less of a chore, you will be allowed to apply several substitutions, one after the other.
The Challenge
We'll start simple...
@quartata Kinda. It's an intrinsic part of the language itself, rather than a separation between components like in other shells.
The key point to remember is that PowerShell is an object pipeline, not a string pipeline like other shells. Passing things from one command or value to another via the pipe passes it as an object, so methods and the like can be preserved and manipulated.
For a really simplistic example, here's an Exchange-specific command
Get-AddressList | Update-AddressList
The first command will return a collection (it can be thought of as an array, though it's not really) of all address lists in the environment. The second command will be able to implicitly parse the .Identity parameter of the input object(s) and use that for execution.
this is the brief I have to do:
Its for an athletics long jump contest. The program will
1. prompt the user for the names of competitors, then
2. for each competitor, ask for the distances that they jumped, then
3. print a table of competitors and their best jumps, and then finally,
4. print the ...
We've got some pretty great challenges here. However, after a month or so, challenges get little to no activity. Since we aren't a Q&A site, we rarely get traffic via searches. I would love it if we could introduce users to high quality questions that they may not have found on their own.
I b...
@orlp I agree that variety is important, but I'm not sure if that restriction really promotes variety. We have quite a few challenges from Helka Homba that are quite different from each other
@NathanMerrill I'm with orlp on the promote-author-variety aspect. I also think it would be better if we narrowed the scope of the tour. Something like a tour of string manipulation challenges ... a tour of sequence and subsequence challenges ... etc.
It is well known, in the field of Mathematics studying infinity, that the Cartesian product of any finite amount of countable sets is also countable.
Your task is to write two programs to implement this, one to map from list to integer, one to map from integer to list.
Your function must be bij...
An indian legend tells the story of the alleged inventor of the chess game, who impressed so much the emperor of India with his game that he would get rewarded with anything asked.
The man said he wanted to be paid in rice. He wanted a grain of rice for the first square of the chessboard, two fo...
@orlp wish I had seen that challenge before Dennis did. I have a matlab program around here somewhere that works exactly the way his works and could have been easily ported to MATL
Determine If a Challenge is Worth Answering
I am a very casual code golfer, and don't often see posts until the show up in the "Hot Network Questions" sidebar over on StackOverflow. Usually, I'm late to the game, and since the only language I know is Python, there is little point in me answerin...
@NathanMerrill That would also break many customized settings required for the blind or other hard-of-seeing, or for other things like screen readers or aggregators.
The Conway base 13 function is a function created by British mathematician John H. Conway as a counterexample to the converse of the intermediate value theorem. In other words, even though Conway's function f is not continuous, if f(a) < f(b) and an arbitrary value x is chosen such that f(a) < x < f(b), a point c lying between a and b can always be found such that f(c) = x. In fact, this function is even stronger than this: it takes on every real value in each interval on the real line.
== The Conway base 13 function ==
=== Purpose ===
The Conway base 13 function was created as part of a "produce...
@TimmyD its similar to clear stylesheets. Right now, if I don't want all <a> tags to be underlined, I need to add a stylesheet that overrides the default. However, browsers don't have to use stylesheets. If I'm reading impaired, I may simply never apply stylesheets on a webpage.
but the flag that says "don't apply default styling" could similarly be ignored if the user/browser wanted to. But right now, no browser supports such a flag, AFAIK
So I have an array a. Let's say I want to run eval on each element. The conventional way would be a.map{|x|eval x}, but is there a way I can pass the reference to eval? Like how I can do a.map(&proc)?
A bit of shameless self-promotion. While trying to figure out test cases for the negative font challenge, I've come across an interesting combinatorics problem:
I'm looking for a set $S$ of (ordered) lists of $n$ numbers such that:
Each number appears at least once as the first numbers.
Each number appears at least once as the last numbers.
Each possible ordered pair of adjacent numbers should appear at least once.
Let's say I'm looking at the number...
Print the Nth non-palindromic number
A palindromic number (in case you don't know) is a number which reads the same backwards and forwards (example, 11). The first 15 non-palindromic numbers are: 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26. They can be found at the OEIS here. I co...
This was inspired by a Minecraft mini-game. The rules are pretty simple: you run and jump around, and every block you step on disappears once you've stepped on it. The goal is to be the last one left.
Your bot should be a complete program. It should accept input as a command line argument. The i...
@NathanMerrill anyway, the reason I have them is that in the underlying problem the first and last number form a unique "pair" with the start and end of the list.
introduce a "start of list marker" (e.g. ^) and an "end of list marker" (e.g. $). now look for all possible pairs with those included (where having ^ second, $ first, or (^,$) are not considered possible)
Between the Lines
code-golfgraphical-outputnumber
While doodling around on square-ruled paper the other day, I came up with the above negative-space font for digits. In case you haven't spotted it yet, the spaces between the above shapes yield the golden ratio 1.618033988749. In this challeng...
I was reading this answer on Quora that debunks myths about Chile, one of which is that "Chile is very narrow". The answerer basically said "No, it's not that narrow; it takes three hours to go from one side to the other, and it's like that for a few European countries too." ...... As an American, that is very narrow. :P
algo/coding question. If I give you 9 letters and ask you to produce the longest word in a dictionary that can be made from a subset,how long does that take?
@Lembik By "made from a subset", do you mean you want words that use only that 9 letters, or that you're picking k <= 9 of the 9 letters and you want words using only those k letters?
Then can't you pass through each word, keeping track of which of the 9 letters have been seen as you go, breaking out if you see an unrecognised letter. If you make it to the end then the word uses only those 9 letters, at which point you check if it's longer than the current record?
While doodling around on square-ruled paper the other day, I came up with the above negative-space font for digits. In case you haven't spotted it yet, the spaces between the above shapes yield the golden ratio 1.618033988749. In this challenge, your task is to take a number as input and render...
@Geobits I was thinking that too - every state I've lived in is longer than three hours, though not all are wider (top to bottom) than three hours. Still, the narrowest one is like 2.5 hours, so...