AJ__20's blog

By AJ__20, history, 17 months ago, In English

You are given an array of strings A of size N. You need to pick two strings Ai and Aj such that len(Ai)* len(Aj) is maximized. Thanks in advance. Edit : Sry, forgot to add the constraints : there was a condition stating those two strings should have no common characters, then what would be the optimal solution ?

Full text and comments »

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

By AJ__20, history, 17 months ago, In English

I was given a question with integer array A of size N, And asked to find answer for Q queries. Each query consists of (L, R, Min, Max). One need to find the minimum sum in the given range(L, R) with atleast 'Min' element and atmost 'Max' elements should be in the minimum sum. Constraints : 1 <= N <= 1e5, 1 <= Q <= 1e5, 1 <= Testcases <= 1e5. I tried brute force approach and got TLE. I searched the internet for the optimal approach and couldn't find the answer, so could anyone explain how to approach this problem? Edit : All the queries are available to function as a parameter when the function is invoked.

Full text and comments »

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