## Given N intervals and each interval has a cost, how’d you find the maximum sum of any two non overlapping intervals in (NlogN) given 2

This was asked by Amazon in their campus dive.

## What happens when identical overlapping effects have their end-condition met?

The Dungeon Master’s Guide errata (direct download) added the “Combining Game Effects” section which states (emphasis mine):

Different game features can affect a target at the same time. But when two or more game features have the same name, only the effects of one of them—the most potent one—apply while the durations of the effects overlap. […]

So with overlapping things, one instance will be “active” (will have effects) and the other will be “inactive” (won’t have effects). That said, I think my question will make more sense with examples:

1. The Fire Elemental’s Fire Form trait:

[…] The first time it enters a creature’s space on a turn, that creature takes 5 (1d10) fire damage and catches fire; until someone takes an action to douse the fire, the creature takes 5 (1d10) fire damage at the start of each of its turns.

If a creature is under the effects of multiple instances of Fire Form, and somebody uses their action to douse the fire, are both instances removed or only one?

[…] If the target willingly moves before then, it immediately takes 1d8 thunder damage, and the spell ends. […]

If a creature is under the effects of multiple instances of booming blade, and they move, are both instances removed or only one?

3. The hold monster spell:

[…] At the end of each of its turns, the target can make another Wisdom saving throw. On a success, the spell ends on the target. […]

If a creature is under the effects of multiple instances of hold monster, and they succeed on a save, are both instances removed or only one?

Can an “inactive” effect end when its end-condition is met (letting them end simultaneously), or do these sorts of things always end one at a time? Or perhaps the answer is something in-between?

There is also the following related question:

• Can multiple creatures grapple a single target?

Both answers there supports that if you are grappled by multiple creatures and you make a check to remove a grapple, you only remove one of the grapples. It’s not perfectly analogous situation but it is somewhat similar.

## Applying overlapping skills to reduce difficulty in Numenera

I know in Numenera you can apply maximum of 2 difficulty reduction from a skill check. Is there any guidance on applying overlapping skills? Some examples:

• Character tries to identify plant people. They’re trained at plants and animals (two separate skills), thus reducing difficulty by 2.
• They try to to dash and jump. They’re trained in athletics and jumping (again, separate skills), -2 difficulty.

## Find the key points of the outer layer of n overlapping rectangles – Divide and Conquer

Given a set of $$n$$ rectangles depicted as: $$[Li, Ri, Hi]$$ whereby the corners of the $$i-th$$ rectangle are – $$(Li, 0), (Ri,0), (Li, Hi)$$ and $$(Ri, Hi)$$.

The goal is to print all of the key points of the outer layer of the $$n$$ overlapping rectangles (given in a list).

Key points $$(Xj, Yj)$$ are the points that collectively portray the outer layer of the rectangles – look at the example below:

Given the two blocks [4, 13, 4] and [2, 7, 10] the output should be: [2,0], [2,10], [7,10], [7,4], [13,4] and [13,0] (The points that are marked red).

This should be done in $$O(nlogn)$$ time where $$n$$ is the number of buildings (rectangles).

I have tried to solve this problem by –

(1) Sorting the blocks by priority: $$Li$$ then $$Ri$$ then $$Hi$$.

(2) Compare any two blocks: $$[Li, Ri, Hi]$$ and $$[Li+1, Ri+1, Hi+1]$$ (15 different cases like Li==Li+1 and Hi< Hi+1 and stuff like this).

(3) Remove/add points according to condition (using AVL)

This works in some cases, but in others it fails miserably. I think this can be solved by Convex Hull algorithms, we have only learned the divide and conquer method so far – but I cannot link between this question and this method. I hope you can help me with this one!

Thank you

## Play overlapping Audio

I’ve imported two wav-Files and want to play them successively. Booth last about 1sec but I want to start the second while the first is still playing. I tried AudioOverlay but it didn’t work. Is it possible at all? Ma version 11

## Find two non overlapping paths in undirected graph

I’ve been struggling on how to approach a problem for over two weeks now. I am supposed to generate an undirected graph which represents a map of streets, and I am supposed to divide the map into two sets of non overlapping streets and both paths should be roughly the same distance.

Is this a common CS problem? What kind of algorithm should I use to solve it?

I’m just looking for a general direction here on what kind of algorithm should I use to do that. I’m a self taught newbie in CS and maths so I have some major gaps in my formal knowledge. The thing is, that I’m supposed to show that the technique I use to solve it involves AI. Initially I tought that I could ask this question aiming to solve the problem straight from the graph. But I now realize that my lack of technical knowledge prevented anyone from clearly understanding the problem.

Anyway, I thought of solving the problem by what I think is the Hungarian Algorithm to solve the Travelling Salesman Problem as shown here. I expected to obtain the most optimum path to traverse the whole graph and after that walk such path and stopping in the edge closest to half the total distance in order to have the two paths I required. However, not sure if it will work and I’m probably going in a completely wrong direction here. Thanks in advance.

## What’s the best way to model similar tables with overlapping functionality?

I’m building a sports event/tournament/league management app for myself, and I’m stuck on the best way to model how Teams should relate to the different competition types.

Some background regarding the goals of the model:

• using postgresql & graphql
• Players earn points for participating in various events (tournaments &/or leagues) – calculated after each event.
• Teams are made up of 1 to multiple players (depending on type of tournament or league) through a team_players join table.
• Teams currently just have a tournament_id to join them to a tournament.
• I’m making a separate Leagues table due to enough differences from how Tournament data is stored.
• However, Tournament Teams & League Teams are exactly the same other than their event type & a couple quirks with how the points system calculates.

The crux of the question: Should I split out LeagueTeams to their own table & duplicate all the application logic that overlaps with TournamentTeams, or should I use one Teams table with 2 foreign keys (league_id or tournament_id)?

I feel like using one Teams table would be faster to get everything wired up on the application side initially, but I’m concerned it could end up complicating things long term…? Will it be more irritating always having to remember to query Teams by their event type in the future? Just trying to make sure I’m not missing something. Any guidance?

## Separate overlapping clusters

Suppose I have multiple data points in 2d (x,y) that are either labeled as A, B, C, or D. I find a minimum bounding area for points that are labeled as A and refer to it as cluster A. I can do the same thing for B, C, and D. After doing this, chances are high that cluster A will overlap with cluster B, C, or D. My goal is to find an algorithm to discard points so that

1. There will be no more overlaps between clusters
2. Discard as little number of points as possible
3. The area “shrunk” for each cluster should be as similar as possible. Meaning the old minimum bounding area minus the new minimum bounding area should be similar among different clusters.

We can assume that the initial cluster roughly makes sense, which means the labeling is not random. The clusters have roughly a 20% overlap between each other. To potentially make the problem simpler, we can assume the area of each cluster is convex. Although not 100% of my datasets are convex of each clusters I would be happy if I can solve this problem for them first. If there isn’t an optimal solution for this I am also interested in greedy solutions.

I am also having a hard time to figure out what kind of keyword should I google to find similar problems for the solution. I would appreciate any pointers. Many thanks.

## Parted saying “cant have overlapping partitions” but no partitions overlap

Image of issue

Hello all, I am having an issue with my raspberry pi. I am trying to move it from one sd card to another larger one,and when I resizepart it says there is an overlapping partition, but I do not see one. Is there something i am missing?

Log:

``(parted) print free Model: Generic STORAGE DEVICE (scsi) Disk /dev/sda: 128GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags:  Number  Start   End     Size    Type      File system  Flags         32.3kB  4194kB  4162kB            Free Space  1      4194kB  1936MB  1932MB  primary   fat32        lba  2      1936MB  15.9GB  14.0GB  extended  5      1938MB  1971MB  33.6MB  logical   ext4  6      1971MB  2044MB  72.4MB  logical   fat32        lba  7      2047MB  15.0GB  13.0GB  logical   ext4         15.0GB  15.9GB  932MB             Free Space         15.9GB  128GB   112GB             Free Space  (parted) resizepart 7 End?  [15.0GB]? 100.0GB Error: Can't have overlapping partitions. (parted) ``