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

Автор hars123, история, 5 лет назад, По-английски

I am trying to find number of elements smaller than or equal to a particular value inside the multiset. I want a logn time approach. I have tried using distance(s.begin(),s.upper_bound(val)). But using distance method could take O(N) time in worst case.Can someone help me.

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

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

Автор hars123, история, 5 лет назад, По-английски

I have tried this problem a lot and also figured out the states. I am trying to build up a 2D dp table dp[i][j] where first i-1 signs are satisfied and last number in the sequence is j. can someone help me in finding out the transitions for these states and solve this problem in O(N^2). If someone could suggest a top-down approach it would be really helpful as i generally find it difficult to find transitions using bottom-up approach.

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

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

Автор hars123, история, 5 лет назад, По-английски

I am finding it difficult to find the relation for transition from one state to another. i.e. if dp[i][j] represents no of ways of distributing j candies among positions [1,i]. Can someone explain what should i think to find that transition. Or i am just unable to observe the pattern.

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

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

Автор hars123, история, 5 лет назад, По-английски

Substring Xor

Can someone explain me the detailed method about how to use tries and binary search to solve this problem.

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

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

Автор hars123, история, 6 лет назад, По-английски

the constraints for n and k are upto 10^6. I wanted to efficiently precompute all the binomial coefficient (n choose k) and store them somewhere for further use. Please help me!. Thanks in advance!.

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

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

Автор hars123, история, 6 лет назад, По-английски

I am recently solving a problem to find a^(n!)%m and got stuck. please suggest how to solve this problem and some resources and problems to learn concepts related to modular arithmatic.

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

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