bablu_45's blog

By bablu_45, history, 2 months ago, In English,

I am just curious about the correlation between chess and CP . It would be great if you could share your chess rating (FIDE or chess.com) rating. Have you guys ever met someone who has high rating in chess (around 2000-2200) and also on CF(around 2400)?

Read more »

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

By bablu_45, history, 2 months ago, In English,

Normal palindrome is defined as a string that reads the same backwards as forwards, for example "abccba". Chunked palindrome is defined as a string that you can split into chunks and it will form a palindrome. For example, "volvo". You can split it into (vo)(l)(vo). Let A = "vo", B = "l", so the original string is ABA which is a palindrome.

Given a string str, find the maximum number of chunks we can split that string to get a chuncked palindrome.

For eg

:- "aaaaaa", output is 6 ((a)(a)(a)(a)(a)(a))

:- "volvol" output is 2 ((vol)(vol))

Length of string <=2*(10^4)

I can think of a greedy way to solve this problem but not able to prove if it's optimal.

Read more »

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

By bablu_45, history, 2 months ago, In English,

Given an array of roses. roses[i] means rose i will bloom on day roses[i]. Also given an int k, which is the minimum number of adjacent bloom roses required for a bouquet, and an int n, which is the number of bouquets we need. Return the earliest day that we can get n bouquets of roses.

Example: Input: roses = [1, 2, 4, 9, 3, 4, 1], k = 2, n = 2

Output: 4

Explanation:

day 1: [b, n, n, n, n, n, b]. The first and the last rose bloom.

day 2: [b, b, n, n, n, n, b]. The second rose blooms. Here the first two bloom roses make a bouquet.

day 3: [b, b, n, n, b, n, b]

day 4: [b, b, b, n, b, b, b]

Here the last three bloom roses make a bouquet, meeting the required n = 2 bouquets of bloom roses. So return day 4.

I am looking for a efficient D.P solution (if possible).

Read more »

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

By bablu_45, history, 3 months ago, In English,

Given a 1-d array candy crush, return the shortest array after removing all the continuous same numbers (the no of occurences of repeating number >= 3)

input: 1-d array [1, 3, 3, 3, 2, 2, 2, 3, 1]

return: [1, 1] (Explanation:- 133322231->133331->11).

133322231->122231->131 gives answer as [131] which is not the shortest.

Time complexity should be better than O(n^2)

Read more »

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

By bablu_45, history, 3 months ago, In English,
 
 
 
 
  • Vote: I like it
  • -19
  • Vote: I do not like it