code_tycoon's blog

By code_tycoon, history, 2 years ago, In English

A K-periodic string is a circular string that remains same when it is rotated by K units. Given a circular string s, find whether there exists a permutation of string s which is a K periodic circular string and if it exists then find lexicographically smallest permutation of s which is a K periodic circular string. Return empty string if there does not exist a valid permutation of s which is a K-period string. Note: You can rotate the string in any direction.

Example 1 : s = "abba" k = 2 Output 1 : "abab"

Example 2 : s = "abbbbbb" k = 4 Output 2 : ""

Constraints : 1 <= length of string s <= 1e5 1 <= k <= 1e9

Please help in this problem and tell your approach to the problem

Full text and comments »

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

By code_tycoon, history, 2 years ago, In English

You are given an Array of stocks denoting profits which you can get on day 1 by selling them, is of n size, and a query array. You have return array of size query.length, where ith value denotes no. of ways in which you can choose all the values from profit array where the acquired totalprofit is >= query[i];

On day1 if you choose some value, you will get full amount, day 2 the profit will divided by 2 , day 3 it will divided by 4 and so on while doing half only integer value will count;

TestCase -

Stocks Profit on Day 1 — [10, 5] Query — [10, 12, 15]

ansArray = [2, 1, 0]; ansArray[0] = 2, because we can choose values in 2 ways first choose 10 on day1, and then 5 on day2, so 10 + 5/2 = 10 + 2 >= 10 second choose 5 on day1, and then 10 on day 2, so 5 + 10/2 = 5 + 5 >= 10

ansArray[1] = 1 because there is only one way to choose choose 10 on day1 and then 5 on day 2, so 10 + 5/2 = 10 + 2 >= 12 5 and 10/2 wont work here; similarly ansArray[2] = 0;

If someone can give some solution to this problem it will really help me I am thinking about this from about 2 days and not able to come up to a satisfactory solution. Any help is appreciated.

Full text and comments »

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

By code_tycoon, history, 3 years ago, In English

This question was asked in hackwithinfy, I could not approach this problem anyhow, can anyone tell me the optimal approach to solve these type of problems and the solution of this specific problem. Here is the question : part1 part2

Full text and comments »

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

By code_tycoon, history, 3 years ago, In English

I have noticed that in the current months the frequency of div2, div3 contests have been reduced drastically. I request Codeforces to kindly organise more and more contests in the coming time. More contests help us to improve our logics , it helps us to solve more learn more and eventually grow more. More and more contests are necessary to make Cp interesting. If you agree with my idea kindly support this post by upvoting!

Full text and comments »

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

By code_tycoon, history, 3 years ago, In English

Here is the Problem Image : Click here

Sample Input output and constraints : CLICK here

Please specify an approach for this problem

Full text and comments »

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