## Changing category subject in short intervals

I would like to know if it is possible to not get penalised by google for changing the subject of a category entirely. I would like to swap a category that I have built on a webpage, for one with a more relevant (as of now) topic. Changing description, content and title etc… would this destroy my SEO? It has amassed backlinks of great quantity and quality over the course of time and I seriously would not like to have them wasted or passed with internal links as the page itself is invaluable.

Assume anchors to my webpage were all "" for convenience purposes. They are nothing particularly descriptive.

Any input would be appreciated

## Understanding growth function of closed intervals in $\mathbb{R}$

I as studying VCdimensions and growth functions and found the following example on Wikipedia:

The domain is the real like $$\mathbb{R}$$. The set H contains all the real intervals, i.e., all sets of form $$\{c \in [x_1, x_2] | x \in \mathbb{R}\}$$ for some $$x_{0, 1} \in \mathbb{R}$$.

For any set C of m real numbers, the intersection $$H \cap C$$ contains all runs of between 0 and m consecutive elements of C. The number of such runs of $${m+1 \choose 2} + 1$$, so Growth(H, m) = $${m+1 \choose 2} + 1$$.

Can anyone please explain to me what does the term "all runs of between 0 and m" refer to here and why the growth function is $${m+1 \choose 2} + 1$$ and not $${m+1 \choose 2}$$?

Thank you very much!

## 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.

## Are there any known attacks (technical or social) against enterprises where password resets are scheduled on fixed (known) intervals?

A company I know of has a password policy that requires employees to change passwords (on AD server) every 90 days. The vast majority of its new hires start on the 1st of the month. Thus, several hundred password resets happen on a predictable schedule. My intuition tells me that this is tactically valuable information to an attacker (I am an infosec noob).

An attacker could enhance the standard "reply to this with your password" phish with a "reply to this with your password because it is time to change your password" phish. The latter seems less suspicious because the person who wrote the message knows about the password reset policy.

Are there any other attacks enhanced or made possible by a predictable password reset schedule?

I realize that (by the pigeonhole principle) every sufficiently large enterprise with a forced password change policy will have a lot of same-day password changes.

## Counting pairs of intervals where one is a subset of the other

Given a list of intervals with nonnegative endpoints, e.g. $$[3,5][1,7][2,60]$$, the goal is to find the number of pairs of intervals $$I,J$$ such that $$I$$ is a subset of $$J$$. In this particular case the total number is 2 because $$[3,5]$$ is a subset of $$[1,7]$$ and a subset of $$[2,60]$$. Furthermore we were asked to find a solution to this problem with time complexity less than $$O(n^2)$$.

At first I thought of sorting the given sets based on their lower bound and in this example the order would be $$[1,7] \to [2,60] \to [3,5]$$ so the time complexity so far is $$O(n\log n)$$, but I can tell nothing about the total number of pairs cause of the order of the upper bounds of the sets is a mess. Then I thought of sorting them based on their middle element and then performing a Binary Search based on this sorting so my time complexity would still be $$O(n\log n)$$. However now I am stuck and a direction would be appreciated.

## Maximize rental income given a set of date intervals

Suppose you have 1 room that you want to rent out. (AirBnb style) You want to maximize profits that you will get by renting it out.

For example: Given intervals: [[1, 10], [2, 5], [7, 20], [23, 30]] – you could rent it out [2, 5], [7, 20] and [23, 30]

Another example: ([[1, 2], [1, 11], [5, 8], [4, 33], [18, 72]]) = 66

Note: Start and end times of the interval are inclusive

I implemented a brute force solution to this problem. First I sort by start time, then I create all possible subsets and take the longest possible value. This works. But I want to do this using Dynamic programming.

This problem screams DP, but I am not able to figure out if this has an optimal substructure.

My recurrence relation: f(i, j) = f(i + 1, j) or f(i + nums[i], j) if nums[i].start > f[i].end

Can someone help me figure out the thought behind the dp solution for the sub-problem?

Note: this problem is slightly different from job scheduling.

## Algorithm for optimal spacing in intervals

Is there an algorithm to optimally space points within multiple intervals? Optimal in this case means maximizing the smallest distance between any two points so that each pair of points has at least distance X. For example, in the intervals (1,3) and (5,7) you can space out three points with a distance of at least 2 (at 1,5, and 7). But you can’t space out three points with a distance of at least 3. Is there an easy way to do this with a program?

## Cover interval with minimum sum intervals – DP recursion depth problem

I have just found the official solutions online (have been looking for them for a while, but after posting this I quickly found it), and I’m currently trying to understand it. As I can tell, it uses a much simpler DP, which only uses an O(N) array.

Story:
This year I attended a programming competition, where we had a few interesting problems. I had trouble with some of them, and since the next round approaches, I want to clear them up.

The problem in a nutshell
We are given N weighted intervals, and a [A,B] interval. We have to cover the [A,B] interval with the given ones, in such a way, that we minimize the overall weight sum (and then the number of required intervals). We need to print the sum, the number of intervals, and then the intervals themselves. If we can not cover [A, B], we need to report that as a special value (-1).

First thoughts
If we sort the intervals by begin time, then we can do simple 0-1 Knapsack-like DP and solve the problem. Also, if the priorities were swapped (minimize count THAN sum), a simple greedy would do it.

The limits
Basically, all interval starts and ends are in the range 1-1 000 000, and N<=100 000. All intervals lie within [A,B].

My approach
I wrote a recursive algorithm like the 0-1 Knapsack one in python, that also stored the last selected interval – thus allowing the recovering of the selection list from the DP array later. It was a (current_interval, last_covered_day) -> (cost, last_selected_interval, last_covered_day')-like function. I used a dict as a DP array, as a regular array that big would have violated memory constraints and filling it fully would also increase runtime (at least that’s what I thought – but a 1000000 * 100000 array would certainly would!). I wrote the function as a recursive one so it would not fill in the entire DP array and be faster & more memory-efficient.

The problem with this
Simply, I got RecursionError: maximum recursion depth exceededs on larger datasets – 100k deep recursion was simply too much. I read since on GeeksForGeeks that it should be possible to increase it, but I am still not confident that it would be safe. My recursive function is also not tail-call optimizatiable, so that would also not work.

So my questions
Is there a way of solving this problem without DP? If no, is filling in a full table an option with those high limits? Maybe we can come up with a different DP approach that does not use such big tables? Is it safe to just increase recursion depth limits with this kinds of problems?

## Upper bound on the average number of overlaps for an interval within a set of intervals

Let $$\mathcal{I}$$ be a set of intervals with cardinality $$L$$, where each interval $$I_i \in \mathcal{I}$$ is of the form $$[a_i, b_i]$$ and $$a_i, b_i$$ are pairwise distinct non-negative integers bounded by a constant $$C$$ i.e. $$0 \leq a_i < b_i \leq C$$. We say a pair of intervals $$I_i, I_j \in \mathcal{I}$$ overlap if the length of overlap is $$> 0$$.

Define a function $$F(i)$$ which computes the number of intervals in $$\mathcal{I} \backslash I_i$$ that interval $$I_i$$ overlaps with. $$$$F(i) = \sum_{j=1, j \neq i}^{L} Overlap(I_i, I_j)$$$$ where the function $$Overlap(I_i, I_j)$$ is an indicator function which returns 1 if $$I_i, I_j$$ overlap, else it returns 0.

The average number of overlaps for the intervals in $$\mathcal{I}$$, denoted by $$Avg(\mathcal{I})$$ is given by $$Avg(\mathcal{I}) = \dfrac{\sum_{i=1}^{L}F(i)}{L}$$.

The question is, suppose we are allowed to choose the intervals in the set $$\mathcal{I}$$ with the following additional conditions:

1. For any $$t \in [0, C]$$, we have at most $$M$$ (and $$M < L$$) intervals in $$\mathcal{I}$$ such that $$t$$ is contained within those $$M$$ intervals. Stated differently, at most $$M$$ intervals overlap at any point in time.
2. Any interval in $$\mathcal{I}$$ overlaps with at most $$K$$ other intervals, and $$M < K < L$$.

then, what is an upper bound on $$Avg(\mathcal{I})$$ for any choice of the intervals in $$\mathcal{I}$$ satisfying 1, 2?

In case you are wondering, this problem is of interest to me in order to be able to study the run-time of a scheduling algorithm.

I am unable to come up with a non-trivial upper bound for $$Avg(\mathcal{I})$$ and would be interested to know if the problem I stated has been studied. I am also open to ideas on how one may be able to obtain a tight upper bound for $$Avg(\mathcal{I})$$.