Find the max partition of unique elements where each element corresponds to the set pool containing that element

Given a list of sets:

a b c -> _ c d   -> d b d   -> b a c   -> a a c   -> c 

The objective is to find the max partition of unique elements with each element corresponding to the set containing that element.

I was thinking about ordering the elements in n * log(n) based on occurrence in other groups and then iteratively start with the lowest, and reorder the list each time based on subtracting the occurrences of other elements within the lists containing the removed element. We are able to do so, as each unique element contains a set of pointers to the lists where the element is contained in.

I can store the unique elements with its occurrences in a Min-Heap, where each unique element has handler to the node within the Min-Heap, thus we can remove the min and also decrease the key one for others within the same list as the contained element in log(n) giving that we have it’s handler.

Is the approach feasible at all, if not, what approach I can make use of?

How to prevent parsing of a should-be-parsed HTML element from server?

I have a website built with MediaWiki CMS which I host on a CentOS based Apache “shared server environment” (SiteGround).

This website contains a ContactPage contact form in which the subject field is hardcoded to the form wrapper via PHP;
This is odd, because all other fields aren’t hardcoded like this and are actually optional and injected into the wrapper from the form’s default template which I pasted into the main customization file of the CMS (LocalSettings.php);
By the way, All of these optional fields are HTMLForm template-engine fields.

If someone wants to remove the subject field from backend whatever reason, it would be a logistical pain, because, for example, after every automatic upgrade, it will have to be removed again, probably manually, from ContactPage extension relevant PHP source code (unlike all other fields which are optional from the very stable file LocalSettings.php).

My problem

I want to remove the aforementioned subject field and the only very stable ways I have with the current architecture of MediaWiki, are CSS and JS;
But this is problematic because a user can easily turn off both (most users won’t do that, but still).

My question

How to prevent parsing of a should-be-parsed HTML element from server?

As this is an Apache “shared server environment” and I don’t have full access to the server, rather only to .htaccess files, is there any “nasty trick” I could do in .htaccess to prevent the parsing of the should-be-parsed subject field by some criteria (say, its HTML attribute or CSS class or whatever other applicable criteria)?

Is there an advantage in removing an element both from CSS and JS?

I have a website built with MediaWiki CMS.

This website contains a ContactPage contact form in which the subject field is hardcoded to the form wrapper via PHP;
This is odd, because all other fields aren’t hardcoded like this and are actually optional and injected into the wrapper from the form’s default template pasted in the main customization file of the CMS (LocalSettings.php);
By the way, All of these optional fields are HTMLForm template-engine fields.

If someone wants to remove the subject field from whatever reason, it would be a logistical pain, because, for example, after every automatic upgrade, it will have to be removed again, probably manually, from ContactPage extension relevant PHP source code (unlike all other fields which are optional from the steady file LocalSettings.php).

My problem

I want to remove the aforementioned subject field and the only steady ways I have with the current architecture of MediaWiki, are CSS and JS;
But this is problematic because a user can easily turn off both (most users won’t do that, but still).

For now, I have removed the subject field with CSS only but I contemplate to add an “insurance” removal with JS as well to prevent end users that turned off CSS but forgot to turn off JS from whatever reason (say, random cognitive bias) from using that subject field.

My question

Considering IS literature, is it a plausible move to have such “JS insurance” for CSS removals and if not, what will be a better way?

What is the most efficient way to select element specific to the H1

Let's say I'm stupid, but I really want to know the most efficient way to select this specific element:

<a href="/" title=""><h1>MySite</h1></a>
Code (markup):

Here's what I've got from the internet and it's still not specific to the H1 tag:

 a[title] {     color: red; } a[title]:hover {     color: orange;     text-decoration: none; } 
Code (markup):

I want this element as a unique one and style it differently.

GURPS – How many character points would cost a skill to fully manipulate an element?

One of the major advantages of GURPS is creating your character the way you want, since the rules let you create anything. And the spell-casting system is arguably too complex or boring. Putting together those two ways of thinking there is a sub-system that I inherited as GM where the players can cast spells without the casting time plus they don’t have to learn spell by spell to do something like tossing a fireball, there is a “Fire Manipulation” generic spell where the PC that acquires it can freely manipulate fire (or any other element – according to the skill) having the cost in mana scale up to how much he wants to manipulate.

That’s obviously too OP, but I managed to balance it with the encounters in the adventures so far, the problem is that I’m reviewing the rules of this sub-system we are using and I’m having trouble calculating how much it would cost in character points for such a spell.

Such a spell would put together in one multiple spells of the basic system, plus remove the combined casting times. To exemplify: One could cast a fireball at cost of 1 mana, or cast a wall of fire having the cost in mana depending on how many hexagons it would occupy.

How many character points would cost such skill?

That could be in 3rd or 4th editions.

Partitioning bag of sets such that each set in a group has a unique element

Suppose I have a bag (or multiset) of sets $$S = \{s_1, s_2, \dots, s_n\}$$ and $$\emptyset\notin S$$. I wish to partition $$S$$ into groups of sets such that within each group each set has at least one element not found in any other set in that group. Formally, the criterion for a group $$G = \{g_1, g_2, \dots \} \subseteq S$$ is:

$$\forall i: \left(g_i \setminus \bigcup_{j\neq i} g_j\;\neq\;\emptyset\right)$$

The partition $$P = \{\{s_1\}, \{s_2\}, \dots\}$$ always satisfies this requirement, so there is always a valid solution. But what is the smallest number of groups needed? Is this problem feasible or NP-complete?

Another formulation of this problem is to partition a multiset of integers into groups such that each integer has a bit set in its binary expansion that no other integer in its group has set.

How to divide a list in linear time where every element in the first part is smaller than every element in the second list

How to divide a list into to equal part (even-number list size) in linear time where every element in the first part is smaller than every element in the second part

I tried to use QuickSort but in can result in $$O(n^2)$$ time complexity.

Design an algorithms to find the index of the first occurrence of an element greater than that key

Question: Design an efficient algorithm that takes a sorted array and a key and finds the index of the first occurrence of an element greater than that key.

The question above is taken from Elements of Programming Interviews in Python, page $$146$$. It is a variant question.

I think the question does not mention the output if the key given is the largest element in the given array.

I code using python.

def first_k_bigger(A,key):     i, j = 0, len(A) - 1     while i < j:         mid = (i+j)//2         if A[mid] <= key:             i = mid + 1              else:             j = mid     return i 

Idea: I use binary search to find such index. First, we find the midpoint of the array, set two pointers $$i$$ and $$j$$ to be beginning and ending of the array and compare the midpoint element with the key given.

If the midpoint is less than or equal to the key, then the key must be on the right side of midpoint. So, we set the pointer $$i$$ to be midpoint index $$+1.$$

Otherwise, if the midpoint is bigger than the key, then the key must be on the left side of midpoint. So, we set $$j$$ to be midpoint index.

Does my code above cover all possibilities?

HTML element: quotation symbols not selectable?

To include a quotation in HTML, one could simply use quotation symbols:

<p>“Yes,” he said.</p> 

Alternatively, one could use the inline quotation element:

<p><q>Yes,</q> he said.</p> 

Using the inline quotation element has some advantages, e.g., it provides additional semantic information to any person or machine reading the HTML code.

However, I noticed something that seems to me like a severe disadvantage of the inline quotation element. In all the browsers I’ve tried, although quotation symbols are rendered, it is not possible to select the quotation symbols.

In Chrome and Edge, predictably, this means that the quotation symbols are omitted if the user copies and pastes. In Firefox, interestingly, quotation symbols are inserted in the pasted text, even though they do not appear to be selected.

This behavior seems jarring for the user. Is it really the best practice for quotations in HTML? When, if ever, should developers use the inline quotation element?

Is editing a link using inspect element a valid XSS attack?

Using inspect element, I can edit a link so it becomes:

<a id=x tabindex=1 onactivate=alert(1)>StackOverlow Question Title here</a> 

When clicked upon it opens a popup in edge with the text “1”. Is it a possible XSS attack?