Блог пользователя jarvis_yash

Автор jarvis_yash, история, 7 месяцев назад, По-английски

given string which only contains 'J' , 'L' , 'R' as character

find smallest substring of size >=2 which follows following condition no.of J is strictly greater than L no.of J is strickly greater than R

2<= N: length of string <=1e6

Полный текст и комментарии »

  • Проголосовать: нравится
  • -6
  • Проголосовать: не нравится

Автор jarvis_yash, история, 7 месяцев назад, По-английски

Given an array of strings A of size N and two integers B and C Let D be the number of strings of length C that contain exactly B of the strings in words as substrings. Return D modulo (10+9).

|A|<=6 |A[i]|,C<=50 B<=N

Полный текст и комментарии »

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

Автор jarvis_yash, история, 7 месяцев назад, По-английски

In front of you there is a treasure containing many gems, soon you realise that they are not as precious as they seem! Infact they are cursed with black magic and bring bad luck with them so you try to minimise the bad luck you get. You have the power to destroy 1 gem in 1 second. You can destroy gems in any order. You are given a 2D array A, where for i'th gem it takes A[i][0] seconds to give A[i][1] units of bad luck.At any instant, only one gem can give you the bad luck, and you can decide the order in which you want to receive the bad luck. Once the receiving of bad luck starts from any gem it cannot be destroyed and it automatically vanishes after giving A[i][1] units of bad luck. Although while receiving bad luck from any gem, you can choose to destroy any other gem which is available in the treasure. There is no time lapse in between receiving of bad lucks from any two gems. As soon as one gem finishes giving bad luck, you have to choose second gem from the treasure to receive the bad luck. Return the maximum amount of bad luck that you can avoid/destroy. Note: Receiving bad luck is a continous process. And at any instant you cannot receive bad luck from more than one gem. If you are recieving bad luck from any gem then you can choose second gem only after A[i][0] seconds.

|A|<2e3

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор jarvis_yash, история, 8 месяцев назад, По-английски

You are trying to purchase a car and will be visiting a number of locations N (represented as points), each labeled i(1 <= i <= N) There are M roads connecting the points together, and road j(1 <= j <= M) of length d; bidirectionally connects points u, and u.

The car comes with a fuel tank that has a capacity of Lmoving 1 unit of distance for every 1 unit of fuel it expends.

Some of the points have a gas stationg_{i} = 1 if there is a gas station at point i, and g_{i} = 0 if there is no gas station. If you reach a point with a gas station without running out of fuel you are able to fill up your car's tank. (If you run out of fuel just as you reach a point with a gas stationyou can still fill up) If you run out of gas before reaching a gas station then you have no option but to call a tow truck to transport your vehicle.

You reside at location 1, which has a gas stationYour challenge is to create a program that computes the number of locations you can visit without running out of fuel. You must also return home at the end of the journey. You are free to take whichever path you like in order to reach a destination and to refuel at any particular gas station however many times you like.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор jarvis_yash, история, 8 месяцев назад, По-английски

each Person has two attibutes A , B

for two diffirent persons i and j Ai<=Aj && Bi<=Bj then ith person is considered as inferior person & ith person will be removed from list if i and j have equal to case then one of them is removed from list this operation is executed when new Person is added to the list

there are two types of queries

1: add Ai,Bi to the list 2: show size of list

1<=N<=1e5 1<=Ai,Bi<=1e9

Sample Test Case:

5 
1 1 3
1 2 1
2
1 2 2
2

Output:

2 
2

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится