## Weighted automaton counting occurrences of the most frequent letter

Here’s a problem I’ve been dealing with for the past few weeks.

On the alphabet $$\Sigma=\{a, b\}$$, give a weighted (finite) automaton recognizing the language $$\{(u, \max(|u|_a, |u|_b))\mid u \in\Sigma^∗\}$$,

## The DM allowed me to wield two shields, how can I get the most AC and HP, as a Bear Barbarian?

I’m making new character, a level 5 Lizardfolk using two spiked shields. I want to build him as a wall of HP and AC but not sure how best to do this.

So i’m thinking of being a Bear Totem Barbarian until level 5 then maybe going Fighter to level 3 so I can get Battle Master for some battle field control. With more Fighter levels I can get more ASI/feats: Sentinel and Dual Wielding and Tough. The party already has a Wolf Barbarian so some fighter levels may bring something new to the table

At level 5 my stats will be including the lv 4 ASI.

• STR – 18
• DEX – 16
• CON – 20
• INT – 12
• WIS – 16
• CHA – 13

The DM is letting me stack the AC and have proficiency to attack with shields and they count as light weapons.

I’m looking to build out to level 15+, avoiding magical classes, focusing primarily on defense with damage and control as secondary objectives.

## Invalid Menu Items – The most interesting question

The question needs it so I captured the error.It is necessary so please watch it.

https://youtu.be/lME3lY-kNbA if it doesnt open, please try this:

I told the question on youtube video so I share only the code like what I said on video.

I hear that video,video,video are you youtuber? 😀 no, it needed

this one works:

function deneme() {      // Add new taxonomy, make it hierarchical like categories     //first do the translations part for GUI          $labels = array( 'name' => _x( '000', 'taxonomy general name' ), 'singular_name' => _x( '000', 'taxonomy singular name' ), 'search_items' => __( '000' ), 'all_items' => __( 'All Locations' ), 'parent_item' => __( 'Parent Locations' ), 'parent_item_colon' => __( 'Parent Location:' ), 'edit_item' => __( 'Edit Location' ), 'update_item' => __( 'Update Location' ), 'add_new_item' => __( 'Add New Location' ), 'new_item_name' => __( 'New Topic Location' ), 'menu_name' => __( '000' ), ); // Now register the taxonomy register_taxonomy('000',array('post'), array( 'hierarchical' => true, 'labels' =>$  labels,             'show_ui' => true,             'show_admin_column' => true,             'query_var' => true,             'show_in_rest' => true,             'rewrite' => true,             'rewrite' => array( 'slug' => '000' ),             'has_archive' => true,         ));      }      add_action( 'init', 'deneme', 0 ); 

and this is the problem source:

nowadays, I select prayer for functions names 😀 such as masallah ( I hope the god protect ) or insallah ( I hope God will help to become real ) but yes I am here to ask 😀

// 2. ekleme  function masallah() {  // Add new taxonomy, make it hierarchical like categories //first do the translations part for GUI      $labels = array( 'name' => _x( 'Districts', 'taxonomy general name' ), 'singular_name' => _x( 'District', 'taxonomy singular name' ), 'search_items' => __( 'Search Districts' ), 'all_items' => __( 'All Districts' ), 'parent_item' => __( 'Parent Districts' ), 'parent_item_colon' => __( 'Parent District:' ), 'edit_item' => __( 'Edit District' ), 'update_item' => __( 'Update District' ), 'add_new_item' => __( 'Add New District' ), 'new_item_name' => __( 'New Topic District' ), 'menu_name' => __( 'Districts' ), ); // Now register the taxonomy register_taxonomy('Districts',array('post'), array( 'hierarchical' => true, 'labels' =>$  labels,         'show_ui' => true,         'show_admin_column' => true,         'query_var' => true,         'show_in_rest' => true,         'rewrite' => true,         'rewrite' => array( 'slug' => 'districts' ),         'has_archive' => true,     ));  }  add_action( 'init', 'masallah', 0 ); 

## Why is the Tarrasque the most dreaded creature?

The dnd5e Tarrasque does not look that dreadful to me. It seems very vulnerable to airborne attacks. In a world where fly is a third level spell, hippogriffs (among other flying creatures) can be ridden and longbows have a range of 150/600, it would seem that a relatively small force of flying longbowmen can easily defeat it. 20 flying longbowmen only hitting on a crit and having +1 damage from dex bonus will kill it in ~70 rounds. Sounds very long for players but it is only 7 minutes in real time.

Sure, it is still a big challenge for a party of 4 and not every town and village in the realms would be able muster airborne archers. Yet, the King should be able to muster even a larger force if the Tarrasque is an existential threat to his realm. Tarrasque also does not have an AoE attack so seems vulnerable to numbers as long as they can stay out of the fear aura. 1600 longbowmen would likely one-shot kill it, again assuming only hitting on a crit and doing +1 damage from Dex (It would require very disciplined unit positioning, though).

The ancient red dragon, on the other hand, would be a superweapon on the battlefield with its 80 ft fly speed and 90 ft breath weapon every third turn.

EDIT: The archers need magic weapons so the 1600 archer scenario is not very likely. Still, 20 flying archers with magic weapons should be enough.

## Matrix to select most relevant security test cases to automate

I spend some quality time on studying security reports on the internet. I build from it an overview of the most relevant security risk category (Injection, session management, and so on) along with an average risk number (high, medium, low). Now I want to create a matrix that will help to select the most relevant test cases to automate.

I was thinking of having these factors:

• Attack complexity
• Tool availability
• Risk value (high, medium, low)

Is this a good approach? I like to hear a second option about what to change/improve.

## Proof for LeetCode: 11. Container With Most Water problem

I’m new to algorithm correctness proof-writing but am keen to improve my skill there.

I have a first attempt here, but I think I’m missing a final step. The algorithm is for the LeetCode: 11. Container With Most Water problem.

I’ve shown to my satisfaction that only an “advance the lesser” move at any given point can possibly result in a greater area (water volume), but it feels like I’m missing the part where I can say “therefore this algorithm will always find the maximum”.

Any pointers on process, notation, or formalisms is also greatly appreciated. This proof strikes me a bit as “workshop-grade” and I wouldn’t mind getting a bit more elegant about it as I do others.

Problem Statement:

Given an array of non-negative integers hs (heights) where each represents a point at coordinate (i, hs[i]), n vertical lines are drawn such that the two endpoints of line i is at (i, hs[i]) and (i, 0). Find two lines, which together with the x-axis form a container, such that the container contains the most water.

Notation:

• H – Height
• W – Width
• A – Area
       |--W--|         |           ___          |     |      |        |  |  |  |   H     |  |  |  |  |   |     +--+--+--+--+  ---     0  1  2  3  4 

For example, a maximal cross-section A of H ✕ W = 3 ✕ 2 = 6 is between offsets 1 and 3. Note there’s another one of area 6 for range [1..4], so the maximum is not necessarily unique.

The solution approach which seems to work is the following:

1. Create index variables left (L) and right (R) initially positioned at the extreme left (0) and right (|hs|-1) of array hs.

2. Calculate the area as A = H ✕ W where H = min(hs[L], hs[R]) and W = R – L and record it as the maximal area so far.

3. Move the lesser of L or R toward the other.

4. Repeat until R == L, then return the maximum recorded.

Code would look something like this in Python

def max_water(hs):     L, R = 0, len(hs) - 1     max_A = 0      while L < R:         A = min(hs[L], hs[R]) * (R - L)         max_A = max(max_A, A)         if hs[L] <= hs[R]:             L += 1         else:             R -= 1      return max_A 

My proof approach is to show that only advancing the lesser-height index can possibly increase the current area. The thing I don’t quite get is whether this proves correctness; my sense is I’m missing a last step:

Proof

There are four possible cases produced by choosing to advance the lesser or greater-height index (toward the middle) and whether the “advanced-to” height is greater or lesser that the prior. For concise expression, I use L and R to represent the heights of those two positions:

Case 1: Advance greater, new height is greater

    |-----W-----|               |                   |  |  ___     |        |  |   |  H     |  ...   |  |   |      +--+--------+  ---     L  ...   R' R        L < R, advance R to R', R' > R      then:      * H' = H -- because L is unchanged and L = H is still the upper bound.     * W' < W     * => H' ✕ W' < H ✕ W     * => A' < A 

Case 2: Advance greater, new height is lower (or equal).::

    |-----W-----|                  |                |  |  ___     |        |  |   |  H     |  ...   |  |   |      +--+--------+  ---     L  ...   R' R        L < R, advance R to R', R' <= R      then:      * H' <= H -- H' cannot be greater than it was because L = H is still an upper bound.     * W' < W     * => H' ✕ W' < H ✕ W     * => A' < A 

Case 3: Advance lesser, new height is lower (or equal).::

    |-----W-----|                  |                   |  ___     |           |   |  H     |  |  ...   |   |      +--+--------+  ---     L  L' ...   R        L < R, advance L to L', L' <= L      then:      * H' <= H     * W' < W     * => H' ✕ W' < H ✕ W     * => A' < A 

Case 4: Advance lesser, new height is higher.::

    |-----W-----|                  |          |        |  ___     |  |        |   |  H     |  |  ...   |   |      +--+--------+  ---     L  L' ...   R        L < R, advance L to L', L' <= L      then:      * H' > H     * W' < W     * => H' ✕ W' is either <, =, or > H ✕ W     * => A' <, =, or > A 

So the only way an area greater than the current area can possibly be found is by following the “advance the lesser” policy. All the other cases lead to a reduction in area.

What I’m not seeing is how that necessarily guarantees this algorithm will find the maximum.

## Left most derivation and right most derivation

Consider the following CFG U -> U+U |U*U |(U) |-U |r show how the string “-(r+r)” can be generated by the grammar using left derivation and right most derivation.

## Longest subarray with sum at most K

The question is:

Return the length of the shortest, non-empty, contiguous subarray of A with sum at least K.

For example: A=[5,2,-1,0,3],K=1, the result is [2,-1,0]

I am inspired by Shortest Subarray with Sum at Least K. Is it possible to solve this corresponding problem with a monotonic queue? If True, how? If not, Why?

I have struggled with it for a long time. Hope for your help.

## What is the most DPR possible at level 1?

My question is fairly straightforward: What is the combination of feats/race/class/etc that gives the most damage per round at level 1? I’d also be interested to see the maximum possible damage, but this is not the criterion for judgment–just a bonus.

I’m looking to create a level 1 character who is only concerned by doing as much damage as possible at level 1. I should note that there is no consideration for any level past 1 (albeit I am interested in your speculations about level progression). I’m also interested in the requirements for such a character (e.g. the minimum ability scores needed, DM approval, etc).

Here are the stipulations/settings that need to be known:

• All Primary Source Books are available. Basically if it is RAW it is good.
• No home-brewed rules. Starting amount of gold as per the default amount.
• No exceptional magic items are available (only the common ones available anywhere).
• All variants described in the rules are available (e.g. the variant human class).
• Assume no situation modifications (e.g. terrain, advantage, etc).
• Only assume modifications if they are *almost always available. This means we are only interested in DPR (Damage per round).
• Assume no outside buffs from party members or other sources.
• Any temporary buffs can be used as long as they last for the entire combat (or close to it). Rage, for instance, would count.

My research tells me that a Barbarian is likely the best choice for this offhand, I am wondering if anyone can come up with a better idea.

## Is there a name for the class of algorithms that are the most efficient for a particular task?

This would be analogous to the Kolmogorov Complexity of a string, except in this case, I’m interested in the algorithm that solves a given problem using the least number of steps.

We would therefore have to be able to show that any other algorithm is of the same order of complexity as the algorithm in question.

I’m asking because I’m working on a paper that makes use of this concept, and I was surprised when I realized that I’m not aware of any name for this concept, though I’ll concede I’m risking embarrassment if there is such a name, that I’m simply unaware of.