What is the correct complexity of All paths from Source to Target DFS solution?

The question: “Given a directed, acyclic graph of N nodes. Find all possible paths from node 0 to node N-1, and return them in any order.”

The DFS solution is described here. https://leetcode.com/articles/all-paths-from-source-to-target/

I feel like the author likely got the time complexity analysis wrong. I would have asked the author themselves, but from the discussion below, they don’t really respond to questions. So, what is the correct time complexity analysis for this problem, and how to derive it?

I cant find a solution for a question of an array about prefix sum?

if I was given the shuffled array of a combination of prefix sum array and suffix sum array as Input. How to find out the number of initial array possible which can produce input array (combination prefix and suffix sum arrays).

How will we find whether an input array is valid as sum of prefix sum array and suffix sum array

(Leetcode) Combinatorial Sum – How to generate solution set from number of solution sets?

The following question is taken from Leetcode entitled ‘Combination Sum’

Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.

The same repeated number may be chosen from candidates unlimited number of times.

Note:

  1. All numbers (including target) will be positive integers.
  2. The solution set must not contain duplicate combinations.

Example 1:

Input: candidates = [2,3,6,7], target = 7, A solution set is: [ [7], [2,2,3] ]

Example 2:

Input: candidates = [2,3,5], target = 8, A solution set is: [ [2,2,2,2], [2,3,3], [3,5] ]

To solve this problem, I applied dynamic programming, particularly bottom up 2D tabulation approach. The method is quite similar to 0/1 knapsack problem, that is, whether we want to use an element in candidates or not.

The following is my code:

class Solution:     def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]:         if not len(candidates):             return 0         dp = [ [1] + [0]*target for _ in range(len(candidates) + 1)]         for row in range(1, len(candidates) + 1):             for col in range(1, target+1):                 dp[row][col] += dp[row - 1][col]                 if col - candidates[row-1] >= 0:                     dp[row][col] += dp[row][col - candidates[row-1]]         print(dp[-1][-1]) 

However, my codes above do not give solution set. Instead, it gives the number of elements in solution set.

I attempted to generate solution set from my codes above but to no avail. Can anyone help me?

What is the time complexity of determining whether a solution $x$ exists to $x^k \equiv c \pmod{N}$ if we know the factorization of $N$?

Suppose we are given an integer $ c$ and positive integers $ k, N$ , with no further assumptions on relationships between these numbers. We are also given the prime factorization of $ N$ . These inputs are written in binary. What is the best known time complexity for determining whether there exists an integer $ x$ such that $ x^k \equiv c \pmod{N}$ ?

We are given the prime factorization of $ N$ because this problem is thought to be hard on classical computers even for k = 2 if we do not know the factorization of $ N$ .

This question was inspired by this answer, where D.W. stated that the nonexistence of a solution to $ x^3 \equiv 5 \pmod{7}$ can be checked by computing the modular exponentiation for $ x = 0,1,2,3,4,5,6$ , but that if the exponent had been 2 instead of 3, we could have used quadratic reciprocity instead. This lead to my discovery that there are a large number of other reciprocity laws, such as cubic reciprocity, quartic reciprocity, octic reciprocity, etc. with their own Wikipedia pages.

What is the logical reasoning behind Arden’s Theorem proof of unique solution?

Here is the proof for Arden’s Theorem assertion that R=QP* is the unique (only solution) to R=Q+RP. My question is: what is the logical reasoning to prove that any equation is the unique (only solution)? Particularly in this case, how can the procedure

(1) recursively substitute R with R=Q+RP in R=Q+RP, then (2) establish the recursive definition of R, and finally (3) generalize the definition to R=QP*

logically lead to the proof that R=QP* must be the unique (only solution)?

Here is an example of the proof: Arden's Theorem Unique Solution Proof

How to solve a matrix PDE and stop solving when solution becomes singular?


My question consists of two parts:

  1. How do I get mathematica to solve a PDE Matrix system and plot the result? See below for the PDE matrix system. (By plot the result I mean plot the region where the solution $ \Theta$ is nonsingular.)
  2. How do I stop the integration when the solution matrix becomes singular? I know that away from $ (x_1,x_2)=(0,0)$ the solution matrix $ \Theta$ will become singular how do I stop Mathematica from trying to solve pass this point?

The PDE matrix system I am trying to solve is \begin{align} \dot{\Theta}(x_1,x_2)+A&=\lambda \Theta(x_1,x_2) &\quad \text{Equation}\ \Theta(0,0)&=\begin{pmatrix} 1 & -\frac{1}{2} -\frac{\sqrt{3}}{2} \ 1 & -\frac{1}{2}-\frac{1}{2\sqrt{3}}+\frac{2}{\sqrt{3}} \end{pmatrix} &\quad \text{Initial condition} \end{align} I have specified the values of $ \dot{\Theta}(x_1,x_2),A,\lambda$ in the block below:

(* Definitions *) A = {{-(x1^2 - 1), -2 x2 x1 - 1}, {1, 0}} lambda = {{1/2, -Sqrt[3]/2}, {Sqrt[3]/2, 1/2}} (*Value of theta for x1=x2=0 *) ThetaInit = {{1, -1/2 - Sqrt[3]/2}, {1, -1/2 - 1/(2 Sqrt[3]) +      2/Sqrt[3]}} (*Derative of Theta in terms of t. Note \ \frac{dtheta}{dt}=x1'(t)\frac{\partial theta}{\partial x1}+x2'(t) \ \frac{\partial theta}{\partial x2} *) ThetaDot = ( -(x1^2 - 1) x2 - x1) D[Theta[x1, x2], x1] +    x2 D[Theta[x1, x2], x2] 

Notes

  • If you need any clarification please feel free to ask.

Payment Gateway Solution

One of my friend required payment gateway solution for his job portal, as maximum payment gateway do not provide that services to job portals (if its not big name in industry) so what is the solution for the same?
He was using paypal of one of his friend who is in USA for the same but that friend now shifted back to India so need some solution for this problem.
Thank you