Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Bounty Awarded with 100 reputation awarded by Felipe Nardi Batista
-1 byte
Source Link
Nnnes
  • 425
  • 3
  • 7

Ruby, (削除) 97 (削除ここまで) 95(削除) 95 (削除ここまで) 94 bytes

->n,a{r=a.size;1.upto(r-1){|i|r+=[p=a[(a[0,i].rindex(a[i])||i-2)+1..i-1].i].uniq.size,n-p].min};r}

Try it online! Try it online!

In an optimal arrangement, the first name will take one press (Call). Names that have not been called yet take two presses (Up Call), and names that have take varying numbers depending on how many other unique names have been called since then and whether that places them closer to the top or the bottom of the list.

I think this is a strategy similar or identical to WaffleCohn's.

Ruby, (削除) 97 (削除ここまで) 95 bytes

->n,a{r=a.size;1.upto(r-1){|i|r+=[p=a[(a[0,i].rindex(a[i])||i-2)+1..i-1].uniq.size,n-p].min};r}

Try it online!

In an optimal arrangement, the first name will take one press (Call). Names that have not been called yet take two presses (Up Call), and names that have take varying numbers depending on how many other unique names have been called since then and whether that places them closer to the top or the bottom of the list.

I think this is a strategy similar or identical to WaffleCohn's.

Ruby, (削除) 97 (削除ここまで) (削除) 95 (削除ここまで) 94 bytes

->n,a{r=a.size;1.upto(r-1){|i|r+=[p=a[(a[0,i].rindex(a[i])||i-2)+1...i].uniq.size,n-p].min};r}

Try it online!

In an optimal arrangement, the first name will take one press (Call). Names that have not been called yet take two presses (Up Call), and names that have take varying numbers depending on how many other unique names have been called since then and whether that places them closer to the top or the bottom of the list.

I think this is a strategy similar or identical to WaffleCohn's.

-2 bytes
Source Link
Nnnes
  • 425
  • 3
  • 7

Ruby, 97(削除) 97 (削除ここまで) 95 bytes

->n,a{r=a.size;1.upto(r-1){|i|p=a[|i|r+=[p=a[(a[0,i].rindex(a[i])||i-2)+1..i-1].uniq.size;r+=[psize,n-p].min};r}

Try it online! Try it online!

In an optimal arrangement, the first name will take one press (Call). Names that have not been called yet take two presses (Up Call), and names that have take varying numbers depending on how many other unique names have been called since then and whether that places them closer to the top or the bottom of the list.

I think this is a strategy similar or identical to WaffleCohn's.

Ruby, 97 bytes

->n,a{r=a.size;1.upto(r-1){|i|p=a[(a[0,i].rindex(a[i])||i-2)+1..i-1].uniq.size;r+=[p,n-p].min};r}

Try it online!

In an optimal arrangement, the first name will take one press (Call). Names that have not been called yet take two presses (Up Call), and names that have take varying numbers depending on how many other unique names have been called since then and whether that places them closer to the top or the bottom of the list.

I think this is a strategy similar or identical to WaffleCohn's.

Ruby, (削除) 97 (削除ここまで) 95 bytes

->n,a{r=a.size;1.upto(r-1){|i|r+=[p=a[(a[0,i].rindex(a[i])||i-2)+1..i-1].uniq.size,n-p].min};r}

Try it online!

In an optimal arrangement, the first name will take one press (Call). Names that have not been called yet take two presses (Up Call), and names that have take varying numbers depending on how many other unique names have been called since then and whether that places them closer to the top or the bottom of the list.

I think this is a strategy similar or identical to WaffleCohn's.

Source Link
Nnnes
  • 425
  • 3
  • 7

Ruby, 97 bytes

->n,a{r=a.size;1.upto(r-1){|i|p=a[(a[0,i].rindex(a[i])||i-2)+1..i-1].uniq.size;r+=[p,n-p].min};r}

Try it online!

In an optimal arrangement, the first name will take one press (Call). Names that have not been called yet take two presses (Up Call), and names that have take varying numbers depending on how many other unique names have been called since then and whether that places them closer to the top or the bottom of the list.

I think this is a strategy similar or identical to WaffleCohn's.

AltStyle によって変換されたページ (->オリジナル) /