shivam565's blog

By shivam565, 16 months ago, In English

help needed in that question, link of the question : Hotel rooms

Full text and comments »

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

By shivam565, history, 2 years ago, In English

How to find total number of subarrays with sum atmost k?

Constrains :
-1e4 <= a[i] <= 1e4
1 <= n <= 1e5

Full text and comments »

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

By shivam565, history, 3 years ago, In English

This is my Code
This is the problem

Why I'm getting Run Time Error, I'm not able to find why, someone please look into my code.

Got Ac thanks to AC_AC

Full text and comments »

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

By shivam565, history, 3 years ago, In English

We are given an array of n elements and I want to count the total no of such four variables with a sum equal to K, I tried it using multi-map where I store all key-value key(sum of pairs) and value(pair{i,j}) and then two-pointer, I am confused in the case when the sum of two pairs is equal to K, then where I will go (right to I, or left to j) cause If I move in both direction the time complexity will increase, and there are overlapping cases too if I store the frequency of each pair sum.

Full text and comments »

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