### Snapper_001's blog

By Snapper_001, history, 2 months ago, Problem Description

You love strings a lot, so you decided to play the following game.

You have a tree T of A nodes. The tree is represented by a matrix B of dimensions (A — 1) * 2 such that there exist an edge between node B[i]|1| and B[i]

Each node is assigned a lowercase english character, which is represented by a string C of length A. Node is assigned character at position i of string C. You are given Q queries in the form of a matrix D of dimensions Q * 2 For each you query you will perform the following steps:

1. You will move from node p[i] to node D[i] using the shortest possible path.

2. Let V, V...V[K] be the nodes visited in the corresponding order. Create a string \$ such that length of S is equal to K and S[i]=c[v|i]]

3. Store string S in your bag.

Return the number of unique strings you would create.

Problem Constraints

I <= A <= 10 ^ 5

B is a matrix of dimensions (A — 1) * 2

Feel free to share aprroaches Thanks in Advance

1<=B[i] , B[i] <= A

length(C) = A

Conly contains lowercase english alphabets

1 <= Q <= 10 ^ 5

D is a matrix of dimensions Q * 2

1<=D[i],D[i]<=A

By Snapper_001, history, 2 months ago, Given the m ranges that denotes subarray of an array of length n i --> [l ,r] 1<=l<=r<=n Cost of Concatination of two ranges is 1 Find the min cost to overlap the whole array or return -1 if not exist

1<=n<=100

Plz help. Thanks in advance

By Snapper_001, history, 2 months ago, We are given an array of size n and we have to determine if it is possible to arrange the elements in such a way that the absolute difference between two adjacent elements is 1.The first and the last element are also considered adjacent. for example, for array A=[1,2,3,2] the answer is YES. Thanks in advance.

By Snapper_001, history, 3 months ago, You are given an array A of size N. A special number of a subsequence S is a number formed by the concatenation of all the elements of the subsequence S.

Find the count of non-empty subsequences of A having their special number divisible by X and of length K. Since the answer can be huge, output it modulo 10^9+7

I dont know How to start this Plzz help??

Constraint:- 1 <= T <= 10 1 <= N <= 10^3 2 <= X <= 20 1 <= A[i] < 1000 1 <= K <= 100

By Snapper_001, history, 4 months ago, 