## How to apply Python generators to finding min and max values?

I’m solving yet another problem in HackerRank (https://www.hackerrank.com/challenges/determining-dna-health/problem). In short: you are given 2 arrays (`genes` and `health`), one of which have a ‘gene’ name, and the other – ‘gene’ weight (aka health). You then given a bunch of strings, each containing values `m` and `n`, which denote the start and end of the slice to be applied to the `genes` and `health` arrays, and the ‘gene’-string, for which we need to determine healthiness. Then we need to return health-values for the most and the least healthy strings.

My solution is below, and it works, but it’s not scalable, i.e. it fails testcases with a lot of values.

``````import re
if __name__ == '__main__':
n = int(input())

genes = input().rstrip().split()

health = list(map(int, input().rstrip().split()))

s = int(input())
weights = ()
for s_itr in range(s):
m,n,gn = input().split()
weight = 0
for i in range(int(m),int(n)+1):
if genes(i) in gn:
compilt = "r'(?=("+genes(i)+"))'"
matches = len(re.findall(eval(compilt), gn))
weight += health(i)*matches
weights.append(weight)
print(min(weights), max(weights))
``````

Can you advise on how to apply generators here? I suspect that the solution fails because of the very big list that’s being assembled. Is there a way to get min and max values here without collecting them all?

Example values:

``````genes = ('a', 'b', 'c', 'aa', 'd', 'b')
health = (1, 2, 3, 4, 5, 6)
gene1 = "1 5 caaab" (result = 19 = max)
gene2 = "0 4 xyz" (result = 0 = min)
gene3 = "2 4 bcdybc" (result = 11)
``````

This case returns `0 19`

## Bitcoin Generators

BTC GENERATOR FREE

.

Posted on

## Bitcoin Generators

1 BTC FREE PER DAY

.

Posted on

Posted on Tags ,

## ag.algebraic geometry – On the intersection numbers of the generators of \$text{Pic}(X)\$ of a smooth quintic surface

There exists the following result in the literature: There exists a polarized $$K3$$ surface $$(X, H)$$ of genus $$3$$ and a smooth irreducible curve $$C$$ on $$X$$ satisfying $$C^2 =4$$, $$C.H=6$$ such that $$text{Pic}(X) cong mathbb Z(H) oplus Z(C)$$. The theorem follows from (https://arxiv.org/pdf/math/9805140.pdf) theorem $$1.1(iv)$$.

Now Let’s consider $$X$$ to be a smooth quintic hypersurface in $$mathbb P^3$$ with Picard number $$2$$. Then I think it can be shown that $$text{Pic}(X) cong mathbb Z(H) oplus Z(H’)$$, where $$H$$ is the hyperplane class and $$H’$$ is some divisor. Now in order to locate the ample line bundles in $$text{Pic}(X)$$ using the Nakai-Moishezon criterion, we must know the intersection numbers $$H.H’$$ and $$H’^2$$.

In this context my question is the following: Does there exist in the literature an analogous existence result as the first-mentioned theorem for smooth quintic hypersurface with Picard number $$2$$?

To be more precise: Does there exist a polarized smooth quintic hypersurface $$(X, H)$$ in $$mathbb P^3$$ and a smooth irreducible curve $$C$$ for which the intersection numbers $$C^2$$ and $$C.H$$ are known and $$text{Pic}(X) cong mathbb Z(H) oplus Z(C)$$?

Can someone give me any reference which could be even remotely useful in the context of finding out such $$(X,H)$$ and $$C$$

Any help from anyone is welcome.

Posted on

BTC GENERATOR

Posted on Tags ,

## Bitcoin generators

BTC GENERATOR PER DAY BTC FREE

Posted on Tags ,

## alm – SPFX: maintenance of several projects created with different versions of Yeoman generators

Premise: When a new Angular 2+ project is created using the NPM package of the Angular CLI, a local copy of the CLI is added as a development dependency to the project: this ensures that when the CLI is used again to add some additional elements to the project, the original version – which is installed locally – of the CLI is used even if the globally installed version has been updated in the meantime.

SPFX-based projects are mostly created using the Yeomand-based generator provided by Microsoft (@ microsoft / generator-sharepoint) or the community managed PNP (@ pnp / spfx). In either case, the results of the boot process are a project with dependencies, folder structure, and the correct files for that specific version of the generator.

Microsoft quite often releases a new version of the generator. It is not uncommon for a new version of the generator to introduce new features (for example, recent beta support for search extensions has been added) – for this reason, new versions of the generator often also update the version of dependent packages (React, user interface, etc.).

It is not uncommon as a developer to have to manage several different projects that have been created using different versions of the generators. This can cause serious problems: if a builder is running on an existing project – for example to add a new Web Part – the currently installed version of the builder is used. Obviously, this means that the new generator will use models whose dependencies will not correspond to the original models.

Since it is not always possible to update old projects to the new dependency set, I started to look for a way to run an old version of a generator on a project without having to constantly change the currently installed version.

Unfortunately, contrary to what Angular does with the Angular CLI, there is apparently no way to install a Yeoman generator to be used only "locally" in a specific project. Therefore, when Yeoman is used, only generators installed worldwide are available, without the possibility of choosing a specific generator version.

Is there a solution to this? How to invoke an old version of a Yeoman generator when a new version of the generator has already been installed (globally)?

Posted on

## How to Create an XML Site Map Without XML Site Map Generators

Hi all. I am currently trying to work on my website.

How does XML work? Is it basically HTML but different?

## rational points – Two other generators necessary for an elliptical curve Z / 6

We are looking for elliptic curves of rank 8 with the Z / 6 torsion subgroup using recently discovered families similar to those of Kihara (the Kihara family is described in https://arxiv.org/pdf/1503.03667.pdf ).

Today we came across a curve

$$(0.8169768624655967629114128598.0, -451787550647310420612086468536366715869054405951830599,0)$$

Magma Calculator (http://magma.maths.usyd.edu.au/calc/) and mwrank with $$-b12$$ return 6 generators for this curve.
Magma V2.20-10 (STUDENT) runs out of memory when running the following code:

``````SetClassGroupBounds("GRH");
E := EllipticCurve((0,8169768624655967629114128598,0,-451787550647310420612086468536366715869054405951830599,0));
MordellWeilShaInformation(E);
``````

Sagemath returns $$8$$ for the upper limit of the analytical rank, even for max_Delta =$$3.3$$ (we always test more than max_Delta):

``````E = EllipticCurve((0,8169768624655967629114128598,0,-451787550647310420612086468536366715869054405951830599,0))
E.analytic_rank_upper_bound(max_Delta=3.3,root_number="compute")
``````

Is there a way to find two other generators?

A similar question for the $$6$$ <= Rank (E) <= $$7$$ the situation was successfully resolved by Jeremy Rouse (One more generator needed for a Z / 6 elliptical curve) but our software chokes when we try to follow its instructions.

We are ready to award a bonus $$100$$ (all my current reputation, how can I transfer it?) for the two generators. In addition, your name (with ours) will be published at the bottom of the page here: https://web.math.pmf.unizg.hr/~duje/tors/z6.html

Max

Posted on