Spliting strings into groups of similar strings

I would like to group a list of strings into groups of strings differing by max 1 character:

For instance, given:

[John, Alibaba, Johny, Alidaba, Mary] 

I would expect three groups:

[John, Johny], [Alibaba, Alidaba], [Mary] 

My first thought was about using some clustering algorithm with Levenshtein distance but that seems like an overkill to me.

Is there a better approach?

My DM insists on rolling a single save for groups affected by AoE save spells. How does this affect my odds of successfully affecting the enemy?

As the title question, my DM rolls a single d20 save for groups affected by my area of effect spells that require a save, in order to save time. I can’t help but feel like I’m being ripped off by this as a wizard with primarily AoE save-or-suck spells. I don’t know if this is just a feeling or if the probabilities actually back this up. I know this can also work in my favor but it still feels off.

How are the probabilities affected when a (homogenous) group gets a single save vs. each individual in the group having their own save? I want to know specifically if this works more in my favor or more in the favor of my enemies, or if it is statistically speaking a 50/50 split. I am looking for evidence that this is a bad idea (whether it benefits me or harms me) and that the DM should roll separately for each affected target in the area of effect.

I realize this probably puts the odds in my favor when targeting weak saves in the group (i.e., WIS save on a group of ogres or orcs), but this will not always be the case and especially when there are mixed enemies in the AoE. So far we have only faced groups that contained single enemy types so I don’t know what happens when there are two different enemies with two different saves.

Ideally answers will address a sliding group size (2..N group members, 5 is probably a good stopping point) and a range of save DCs — DC 14-19 should address most levels of play.

Maximum number of similar groups of a given size that can be made from a given array

I am given an array of numbers, not necessarily unique, and the size of a group. Let the array be denoted by $ B$ and the size of the group be $ A$ .

I need to find the maximum number of groups with the exact same contents and of size $ A$ that can be made from the elements of $ B$ . Once an element is used in a group it is exhausted. A group can have more than one element with the same value as long as the element is still available in $ B$ .

Example:

  1. If the input array is $ \{1, 2, 3, 1, 2, 3, 4\}$ , and the group size is $ 3$ the maximum number of groups that can be made is $ 2$ , which are $ \{1, 2, 3\}$ and $ \{1, 2, 3\}$ .
  2. If the input array is $ \{1, 3, 3, 3, 6, 3, 10\}$ , and the group size is $ 4$ the maximum number of groups that can be made is $ 1$ , which is $ \{1, 3, 3, 3\}$ .

What I have tried so far, is to frame some equations ( given below ) but after that, I am struggling to come up with an algorithm to solve them.

Let $ F_1$ be the frequency of the element $ B_1$ , $ F_2$ be the frequency of the element $ B_2$ and so on till $ B_n$ , where $ B_1 \dots B_n$ are distinct elements from the array $ B$ .

Now I need to choose $ n_1, n_2, \dots n_i$ such that

  1. $ n_1 + n_2 + \dots + n_i = A$
  2. $ k\cdot n_1 \leq F_1\text{ , } k\cdot n_2 \leq F_2\text{ , }\dots \text{ , }k\cdot n_i \leq F_i$
  3. $ k$ is the number of groups and we need to maximize it.

Length of $ B$ can be as large as $ 10^5$ and $ A$ can also be as large as $ 10^5$ .

Please help me find a greedy or dynamic approach to the problem.

What’s the scam? Unknown users joining and leaving WhatsApp groups

I’m on a few WhatsApp groups that have signup links. Lately (last few months) I’ve noticed some very odd activity on a few of these groups: every few days I notice a number (often from a country with a poor reputation for scamming) joining, and then leaving the group, like this:

enter image description here

And I’m wondering, what is the scam being cooked up here? Have they got some kind of brute force bot that signs up for whatever WhatsApp groups it can find? And then does…what? Scrolls through the group member list and harvests their phone numbers? To do…exactly what with them? Send SMS spam, telling people they’ve won the $ 16.4m Bill Gates Philanthropic Award For Owning a Phone?

If that’s the extent of the threat, then I can live with it. But is there anything else these bots could be doing that is more sinister?

Grouping n points into groups of size m with objective to have least traveling distance in each group

Assumptions:

  • There are “n” jobs which are distributed over the city.
  • Company has “k” available workers.
  • Each worker can do “x” jobs per day.
  • “x” is dependent to the worker skills and the distance he travels each day so it’s not a constant.
  • Workers have no initial traveling distance.
  • “s” is a set that shows each workers can do how many jobs based on the distance he travels
  • “d” is the number of days that takes for company to do all the jobs.

Objective: Minimize the “d”


I know this problem is probably NP-hard so I don’t need the exact answer. I think it’s kinda a variation of Traveling salesman problem combining with scheduling and assignment problems.

My algorithm for this problem is to “some how” efficiently ( of course not the most efficient way ) grouping the jobs based on their traveling distance in the groups in to groups of “m” which is the mean of set “s”. Then after each day rerun the algorithm to get better results.

My question is what is the best way to do that grouping? Anyway if you know a better algorithm I would be more than happy to know them.

Cluster or shared collections in logical aggregate groups

We would have date specific trading data for about 10M trades – each day’s data comprising ~1T data in different collections like market,trade,settlements etc.
Since we would not need more than 3 days data at any point of time – intention is to delete all data pertaining to T-3 or more.
There would be 2 possible options:

1.Each trading  day being represented as a separate database  - with the standard set of collections viz marketdata,trade,settlementdata in each database 2.Every collection being appended with the date viz marketdata_10032019,marketdata_10042019 etc  

The first option seems better as:

1. much cleaner in terms of maintenance - just dropping the obsolete databases,rather than scanning collections by name.  2. Dynamic collection names as in second option puts severe restrictions in aggregation possibilities - mongo aggregation does not support dynamic names.  

Would appreciate further views – based on performance,concurrency,scalability,clustering/sharding,maintenance etc

I do not see any question that addresses the used case of trying to cluster/maintain on the basis of a second-level logically aggregated grouping of collections based on date (or any other)

Best UI pattern to allow the user to assign 1 level nested items to two groups

My issue is something similar to this one – Best UI pattern for letting a user assign items to groups

I am looking for a good UI design for mapping items between 2 groups (only one-to-one mapping). These items can be under a parent or by itself. I thought of drag-and-drop/ having checkboxes (or switch like) to turn on for any one group.

Items Group 1 Group 2

Item A
Item A1 checkbox checkbox

Item B checkbox checkbox