Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A competition to solve a particular problem through the usage and manipulation of arrays.
4
votes
Create chunks from an array
C# (Visual C# Interactive Compiler), 78 77 43 bytes
a=>b=>{int i=0;return a.GroupBy(_=>i++/b);}
Try it online!
I think we should be able to just write int i; because 0 is the default of int. I l …
4
votes
Create chunks from an array
F# (.NET Core), 15 bytes
Seq.chunkBySize
Try it online!
Well F# has a builtin...
0
votes
Deal the cards to the players
C# (Visual C# Interactive Compiler), 43 bytes
a=>b=>{int i=0;return a.GroupBy(_=>i++%b);}
Try it online!
17
votes
22
answers
3k
views
Deal the cards to the players
Given an array of cards and the number of players, you need to split the array of cards into a hand for each player. … The array can contain any type rather than a number.
You should not change the order of the array while dealing. …
2
votes
Find the unique twins
C# (.NET Core), 85 84 bytes
x=>y=>x.Where(a=>x.Count(b=>b==a)<2).Intersect(y.Where(a=>y.Count(b=>b==a)<2)).Max()
Try it online!
Naive solution with LINQ (using System;using System.Linq; +31chars …
2
votes
Find the unique twins
F# (.NET Core), 117 115 114 111 108 bytes
115 114 bytes
Another solution with countBy this time:
let u x=x|>Seq.countBy id|>Seq.filter(fun a->snd a=1)|>Seq.map fst|>set
let f x y=Set.intersect(u …
2
votes
Find the unique twins
SQLite, 118 bytes
SELECT MAX(x)FROM(SELECT X FROM A GROUP BY X HAVING COUNT(X)=1
INTERSECT
SELECT X FROM B GROUP BY X HAVING COUNT(X)=1)
Try it online!
First time in SQL, any help is welcome!