Javascript (using external library) (149 bytes)
(n,w)=> _.From(w).Select((x,i)=>({i:i,x:x})).Split((i,v)=>v.x==" ").Where(a=>a.Min(i=>i.i)<=n-1&&a.Max(i=>i.i)>=n-2).First().Select(i=>i.x).Write("")
Link to lib:https://github.com/mvegh1/Enumerable/blob/master/linq.js
Note that this code fails ...
Can somebody help me explain to him/her/whatever why the answer is invalid?
Here is a regex that works fine in most regex implementations:
(?<!filename)\.js$
This matches .js for a string which ends with .js except for filename.js
Javascript doesn't have regex lookbehind. Is anyone able put together an alternative regex which achieve the same result and works in java...
@LeakyNun ah, I just can't reason about this. So, a|b!cd is a hypotehtical cursor placement in ab!cd. I'm missing the connection between what to do with the cursor, and the string. so lets say we broke up by cursor. We'd get [a, b!cd]. Running the regex separately on those 2 entities would yield [a,cd]
@applejacks01 \w means match word character, \w* means match zero or more word characters, and $ means assert that we have come to the end of the string.
So you need to match the second portion with ^\w* instead.
@Downgoat i know what is a signed and unsigned integer, just in Processor/1 there is a instruction for a signed addition, and one for unsigned addition, but AFAIK signed addition == unsigned addition
@TùxCräftîñg that isn't true. The first bit indicates the sign on signed integers. If you do unsigned addition on two signed numbers, then adding two negative numbers would give you a positive
This little blurb from Downgoat's PPCG Design Userscript:
Before you post, take some time to read through the forbidden loopholes if you haven't done so already.
That appears right above the Post your answer button when the script is enabled. Here's what it looks like as I type this:
...
> Weird was extinct by the 16th century in English. It survived in Scots, whence Shakespeare borrowed it in naming the Weird Sisters, reintroducing it to English. The senses "abnormal", "strange" etc. arose via reinterpretation of Weird Sisters and date from after this reintroduction.
I think the question as above is clear, but just in case:
Write a full program (not just a function) which prints a positive base 10 integer, optionally followed by a single newline.
Qualifying programs will be those whose output is longer (in bytes) than the source code of the program, measure...
Summary
Given a list of integers, return the index each integer would end up at when sorted.
For example, if the list was [0,8,-1,5,8], you should return [1,3,0,2,4]. Note that the two 8s maintain their order relative to each other (the sort is stable).
Put another way: For each element in t...
@NewMainPosts can anybody verify what this is called? I've seen it called "grade up" and "grade down", but can't find any outside resources on either term
Racket has so many builtins for ridiculous tasks that probably are never done nearly often enough to warrant it being a builtin (not as bad as Mathematica, though), so I'm surprised that it doesn't have a grading (up/down) builtin
You are using both the grade up ⍋ and grade down ⍒ as monadic primitives.
By definition grade up returns an integer array of indices which specify the sorted order of the expression following it, in ascending order. If any elements are equal (in your example the two letter l's) , they will appe...
why does grading "Hello" return 1,2,3,4,5?
shouldn't it be 2,1,3,4,5?
oooh, I understand. My algorithm is slightly different than Grading, I think
For example, grading "Zambia" returns "2 6 4 5 3 1"
which indicates that the second character goes first, then the sixth character, and so on
where my challenge would return "6,1,5,3,4,2"
which indicates that the first character goes sixth, the second character goes first, and so one
This should be a simple challenge.
Given a number n >= 0, output the super-logarithm (or the log*, log-star, or iterated logarithm, which are equivalent since n is never negative for this challenge.) of n.
This is one of the two inverse functions to tetration. The other is the super-root, whi...
Lets Play Kick The Can!
Kick the can is a children's game. Involving one defender, and multiple attackers. Today it is no longer such a game! Your job is to write a bot that plays it, to win, king-of-the-hill style!
https://en.wikipedia.org/wiki/Kick_the_can
There are some key differences in t...
Partial factorisations of a positive integer
code-golf combinatorics set-partitions number-theory
A collection of positive integers d_1 d_2 ... d_k is a factorisation of a positive integer n if
d_1 * d_2 * ... * d_k = n
Each positive integer has a unique prime factorisation, but in general t...
TBH you're abusing the fact that a person failed to clarify a certain point, which should instead be pointed out the comments as per some meta post that I forget where it is.
Hard-coding the output
Unless the question is an obvious exception (the primary exception being those tagged kolmogorov-complexity), your program is expected to do work, not just print a pre-calculated result. If the question doesn't require input and so a solution which just prints the answer w...
Summary
Given a list of integers, return the index each integer would end up at when sorted.
For example, if the list was [0,8,-1,5,8], you should return [1,3,0,2,4]. Note that the two 8s maintain their order relative to each other (the sort is stable).
Put another way: For each element in t...