Input
An integer n in the range 100 to 10^18 and an integer k in the range 1 to 18, inclusive.
The swap operation
A swap chooses two digits at different positions and exchanges their positions, as long as the swap does not result in a leading zero. For example if we start with the integer 1234...
@Anush another guess for why people don't like your restricted-time challenges - by making the challenges generally just hard to do, the code-golf aspect becomes just pointless as for a complicated program there isn't much golfing leeway. they also kind of seem like homework/do-this-for-me questions as you don't show that you even know it's possible (do you?)
what you like are "find a good complicated algorithm" challenges, but the problem is that once there's already an answer, copying the whole algorithm to golf a bit in another language feels pointless, and making a new algorithm is bound to be very hard
@NewMainPosts (okay that challenge might not be that hard, but for it restricted-complexity and no explicit input size limit fits pretty well)
also brb making a language that takes 60s to start up so it literally can't compete :p
Given an IPv4 address in dotted-quad notation, and an IPv4 subnet in CIDR notation, determine if the address is in the subnet. Output a distinct and consistent value if it is in the subnet, and a separate distinct and consistent value if it is not in the subnet. The output values do not necessari...
Calculate Trinary Complexity
We have a lot of binary questions on this site, but not many trinary questions.
The Trinary Complexity of a decimal integer is the number of iterations of f(n) required to reach a result < 3, where f(n) is the sum of the digits of the trinary representation of n.
E...
ah man I was so close to a decent answer for the digit swapping challenge until i tested 510 and realised my code is doing it in k or fewer swaps, not exactly k swaps
@orlp I do now understand the problem but I don't know enough to provide anything meaningful:) I have the impression that it is a hard problem and I have a hunch that it is impossible to solve for arbitrary t. Maybe one could find a solution if you restrict it to a certain class of t's but I already failed for t(x) = x^k with n(s,r) = n(r) (independent of s)
In the original Shantae game, there are transformation dances that you have to input in time using the D-Pad, A, and B. If you complete a predefined sequence while dancing, you will transform into the corresponding form (or teleport or heal). Your task is to output the corresponding effect when g...
@flawr I find that the problem really simplifies if you look at it from the perspective of the quantized values
e.g. instead of studying where quantize(s + n(s, r)) ends up you start with a certain quantized value, e.g. 4 and ask what the chance is that s ends up being 4
What is a Prime Square?
A Prime Square is a square where all four edges are different prime numbers.
But which ones?
And how do we construct them?
Here is an example of a 4x4 Prime Square
1009
0 0
3 0
1021
First we start from the upper left corner. We are working c...
@orlp let me first take one step back: the problem is that you want to dither before you do the transformation, such that it is correct after the transformation?
@flawr so for a certain value c (I've been using c in my code instead of s*(m-1) for the signal) there are three possible outcomes after quantization Round[c] - 1, Round[c], Round[c] + 1, make sense?
and depending on the distance of c to Round[c] you get different chances for each of those 3 outcomes
@Skidsdev depends on the array's contents e.g. if it contains integers then you can use 1/arr[0] or arr+arr but this doesn't work if the array contains only the empty array.
@Neil oh wait, I factored out one of the arrays, and the other is actually a string (consisting only of /^[UDLRAB.]+$/), 1/a doesn't seem to work for a string
also re: earlier discussion on checking array length. Now that I've factored out the actual array and just have the string left, the string on its own is a condition, because empty strings are falsey
I was now just trying to find out whether we can modify those basis vectors/functions/distributions/bumps/whateveryouwannacallit to exactly represent t[x]
(instead of x)
I mean I think this is exactly what you're trying to do, but I think I was just trying to look at it form a perspective I'm more familiar with:)