![subject](/tpl/images/cats/mat.png)
Mathematics, 13.04.2021 02:50 Person51761
Right now you are doing a complete search over the prefix sums. However, this is not necessary. We know that the only way to get a multiple of $7$ is if both prefix sums have the same remainder $\pmod{ 7}$. Then, what happens if there are a lot of these prefix sums with the same remainder. If they're located at indexes $a_1,a_2,a_3,... ,a_n$, your $O(n^2)$ solution is finding the maximum of all of the differences. But we don't need to check $a_2-a_1$, for example, since we know $a_n-a_1$ is divisible by $7$, and it must be larger. Thus, we only have to find $a_1$ and $a_n$, because all the other differences must be smaller. This means that for each remainder from $0$ to $6$, we can calculate $a_1$ and $a_n$, and find the maximum of their difference, which will be an $O(n)$ solution.
![ansver](/tpl/images/cats/User.png)
Answers: 2
Another question on Mathematics
![question](/tpl/images/cats/mat.png)
Mathematics, 21.06.2019 20:00
Parabolas y=β2x^2 and y=2x^2 +k intersect at points a and b that are in the third and the fourth quadrants respectively. find k if length of the segment ab is 5.
Answers: 1
![question](/tpl/images/cats/mat.png)
Mathematics, 21.06.2019 20:00
Whatβs the answer ? use the picture to see the problem
Answers: 2
![question](/tpl/images/cats/mat.png)
Mathematics, 21.06.2019 22:00
In dire need~! describe how to use area models to find the quotient 2/3 divided by 1/5. check your work by also finding the quotient 2/3 divided by 1/5 using numerical operations only.
Answers: 3
![question](/tpl/images/cats/mat.png)
Mathematics, 22.06.2019 01:00
3questions show how you solved the problem 1. subtract & simplify (βy2 β 4y β 8) β (β4y2 β 6y + 3) 2.multiply and simplify 2x2y3z2 Β· 4xy4x2 3.multiply and simplify (x β 4) (x2 β 5x β 6)
Answers: 1
You know the right answer?
Right now you are doing a complete search over the prefix sums. However, this is not necessary. We k...
Questions
![question](/tpl/images/cats/mat.png)
Mathematics, 10.10.2019 11:10
![question](/tpl/images/cats/ekonomika.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 10.10.2019 11:10
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 10.10.2019 11:10
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/obshestvoznanie.png)
![question](/tpl/images/cats/himiya.png)
Chemistry, 10.10.2019 11:10
![question](/tpl/images/cats/health.png)
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 10.10.2019 11:10
![question](/tpl/images/cats/istoriya.png)
History, 10.10.2019 11:10
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/himiya.png)
Chemistry, 10.10.2019 11:10
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/fizika.png)
Physics, 10.10.2019 11:10
![question](/tpl/images/cats/en.png)