Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Snapper_001's blog

By Snapper_001, history, 20 months ago, In English
Given n 2d points
(x,y) , x<=1e5 , y<=1e5
n<=1e5

find the number of triplet such that all x's are different and all y's are different
ex: valid triplet is (1 , 3) , (2 , 2) , (3 , 1)

pLease share some ideas how to solve it
Thanks in advance

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it

By Snapper_001, history, 2 years ago, In English

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][2]

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][1] to node D[i][2] using the shortest possible path.

  2. Let V[1], V[2]...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][1] , B[i][2] <= A

length(C) = A

Conly contains lowercase english alphabets

1 <= Q <= 10 ^ 5

D is a matrix of dimensions Q * 2

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

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it

By Snapper_001, history, 2 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By Snapper_001, history, 2 years ago, In English

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.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Snapper_001, history, 2 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By Snapper_001, history, 2 years ago, In English

static bool comp(string a ,string b){ return a.size()<=b.size(); }

I used this in leetcode But this gives Error "terminate called after throwing an instance of 'std::length_error' "

after changing it to --> a.size()<b.size() this works How this works????

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it