@ConorO'Brien As per the challenge spec, the key must be assumed to repeat.
So who, what, when still must XOR with 3 at the o, a, e.
@EsolangingFruit In particular though, Funky doesn't care too much about Errors or undefined variables. It's perfectly fine with the idea of a bitshift with undefined.
@EsolangingFruit Funky has a and= b, which I think is the most absurd assignment.
@ATaco Would it help to create a json linking TIO language IDs to highlight.js language ids? Including null for things like ReRegex which don't have a reasonable highlighter.
@Riker I didn't get to say it earlier but If you have any questions about RPI, I'd be happy to answer them. I don't have any obligations to make the school seem good so you can know my answers are honest ;)
@ATaco I've discovered the version of Highlight.js that's publically hosted provides these 23 common langs, and requires you to build a version of it yourself in order to support all the langs it's able to provide.
I believe simply doing that what allow for much better language detection.
(There exists some challenges that require to use the best startegy, but here we don't. Even if you are able to win, you are allowed to make a tie)
Play tic-tac-toe as the second player, and you're not allowed to lose.
I/O method may be:
Input may be the current chessboard(always your last re...
Given an array a that contains only numbers in the range from 1 to a.length, find the first duplicate number for which the second occurrence has the minimal index. In other words, if there are more than 1 duplicated numbers, return the number for which the second occurrence has a smaller index th...
CMC: every number can be represented as a point in n-dimensional cartesian space (where n is large enough for us to not care) such that each point is unique in the number they represent. The axes are the prime numbers so that every number can be decomposed as a multiple of them. For example, the number 24=2^3×3^1×5^0×7^0×... will be represented in this space with the coordinates (3, 1, 0, 0, ...). Given an input integer X, find the distance between X's point in this space and X+1's point.
@user202729 I originally meant for one integer to be given as input, and for you to calculate the distance between that integer and the next one, but that is still fine. Can you extend your solution to find the distance between two positive rational numbers?
0.8 = 4/5 => (2, 0, -1, 0, 0, ...)
@LeakyNun do you think this can be extended into the positive reals?
Left and right Riemann sums are approximations to definite integrals. Of course, in mathematics we need to be very accurate, so we aim to calculate them with a number of subdivisions that approaches infinity, but that's not needed for the purposes of this challenge. You should instead try to writ...
Given an array a that contains only numbers in the range from 1 to a.length, find the first duplicate number for which the second occurrence has the minimal index. In other words, if there are more than 1 duplicated numbers, return the number for which the second occurrence has a smaller index th...
Python 3, 94 92 bytes
O(n) time and O(1) extra memory.
def f(a):
r=-1
for i in range(len(a)):t=abs(a[i])-1;r=[r,i+1][a[t]<0>r];a[t]*=-1
return r
Try it online!
Source of the algorithm.
Explanation
The basic idea of the algorithm is to run through each element from left to right, keep ...
This is completely out of left field, but I just want to let you all know that you're absolute geniuses and despite having absolutely nothing useful to contribute to the community at all I'm constantly in awe of everyone here. Just felt like I needed to show some appreciation for the years of entertainment and learning I've gotten from this community :)
@user202729 20 GB should be enough... in fact, my system fits in 20GB (if you don't count /home), with a ton of crap installed and a comfortable amount of space left
Rhombus sequence
Tags: code-golf math sequence
Imagine enumerating the elements of rhombi that which grow [1],[1,3,1],[1,3,5,3,1],… (only odd numbers such that they align nicely). This would look like as follows, note that you always begin enumerating with 1:
01
1 ...
Any final feedback for that challenge?
Anonymous
@user202729 You shouldn't need to defrag NTFS
Anonymous
Unless you're adjusting partitions so that they're contiguous
@BruceForte It looks fine to me, but when it comes to sequence challenges, I usually allow three i/o methods: take n and print the nth term, take n and print the first n terms and outputting the sequence indefinitely. Of course, that's your choice.
Maybe the nth term suits this challenge better, though.
I found a very interesting property of your sequence. If you analyse each side length as a separate sequence you get something pretty intriguing: 1 -> 1, 2, 4, 5, 9, 10, 16, 17 (+1, +2, +1, +4, +1, +6, +1, ...)
@Mr.Xcoder: I changed IO and added a few more test cases
Anonymous
@user202729 For reference, I have a 17GB Xubuntu install with lots of server stuff (MySQL DB, Redis, memcached, a website, and lots of Python and Node stuff)
For instance you have (1), (1, 3, 1), (1, 3, 5, 3, 1), ... Flatten this and take the indices of 1: 1, 2, 4, 5, 9, 10, 16, 17,... it corresponds with the sum of each of those columns (the columns that have exactly 1 element)
@BruceForte I don't think I am going to be the first to post a solution. I think that implementing the algorithm I described is a bit harder than it may seem
Imagine enumerating the elements of rhombi which grow [1],[1,3,1],[1,3,5,3,1],… (only odd numbers such that they align nicely). This would look like as follows, note that you always begin enumerating with 1:
01
1 02 03 04
1 2 3 4 05 06 07 08 09 …
...
@Downgoat I was able to get it anyway because I was being dumb, but thank that might help golf
Anonymous
CMC: Given the filename of a file containing many, many, many lines of text, return a random line (chosen uniformly) from the file. fastest-code (use TIO and /usr/share/dict/words for the file for timing)
A doubly linked list is a data structure in which each node has a value as well as "links" to both the previous and next nodes in the list. For example, consider the following nodes with values 12, 99, and 37:
Here, the nodes with values 12 and 99 point to their respective next nodes, with val...
What is the shortest way we can express the function
f(a,b)(c,d)=(a+c,b+d)
in point-free notation?
pointfree.io gives us
uncurry (flip flip snd . (ap .) . flip flip fst . ((.) .) . (. (+)) . flip . (((.) . (,)) .) . (+))
which with a little bit of work can be shortened to
uncurry$(`flip`...
in 2010 IOL there is an mRNA problem, do other countries teach how they work? we learn it in turkey (not the specific codons for amino acids but how they work broadly and with the examples given a normal student would solve most of the problem in under 5 minutes and this sentence is too long for parentheses)
oh yeah, that one made a lot of people mad not only because of the prior knowledge thing but also because some people claimed (perhaps rightfully) that it's barely even linguistics
The idea of this is mainly from BIO 2017 q1. I got the idea for posting this challenge from my Binary Sequences challenge, since lots of people seemed to like it.
Also, this is the first challenge I've posted without posting on the sandbox. I'll delete it if no one likes it.
Rules
Take in a se...
I know there's a desire on PPCG for challenges to be flexible in terms of what they allow for input and output. However, I think there is an argument to be made that ascii-art is a special case, and should be stricter about the permitted output formats.
As a case in point, there was a recent asc...
Areas of Polygons with Vertices of a Polygon
Rules
Given a list of integer coordinates, l, with a length of at least 4, and an integer n such that n is smaller than the length of l (but at least 3), return the largest area of an n-gon (n-sided polygon) that has all the coordinates of its n vert...
The idea of this is mainly from BIO 2017 q1. This is very similar to my Ternary Triangles challenge.
Rules
Take in a sequence of digits in ternary (base 3); this could be as a string, an array or the numerical value along with the number of preceding zeros.
For each row in the triangle, a row ...
Today while playing with my kids I noticed that an apparently simple toy in the park hid a challenge.
The wheel has a triangle that points to a number, but also has three circles that point to the numbers every 90 degrees from the first one. So:
Challenge (really simple)
Given an integer be...
Once, as a child, I found a spider in my parents' garden. I remember catching it in a jar because I thought it looked unusual, but I never figured out what kind of spider it was and unfortunately didn't get any pictures. I've been looking for it in books and on the Internet since, based on memory...