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

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

I have implemented sliding window method in this problem, but there's TLE for testcase 9 . This is the link. I know the solution is wrong, but I want to know where I am going wrong, so that I shouldn't repeat same mistake again. It would be nice if someone of you will guide me to resolve this issue. Thanking in advance.

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

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

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

Hello guys, I have been recently reading a lot about Maximum Matching in Bipartite Graph. I have found many articles on the same. But all of them lacked the visualization of Hopcroft Karp Algorithm, or how it actually works (using BFS and DFS).

So I hope if anyone can explain the Hopcroft Karp Algorithm in a better way, I would be very thankful of him.

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

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

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

This is good problem and I think my solution is correct but I am getting SIGFPE error for PRIME GENERATOR. The link of my code is here. This problem has been bugging me for hours. If anyone can solve this doubt, it will be a great help!

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

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

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

Hello, guys,

I am still learning algorithms and implementing them. But, Sometimes I get stuck when asked about generating prime numbers in O(N) time complexity. Although, I have implemented Sieve of Eratosthenes, but I have read somewhere that, it requires O(N*log(logN)) or something like that. I find this algorithm as good one, but in some practice problems, we need to implement in O(N) time.

It would be nice if someone of you will guide me to generate prime numbers in O(N) time.

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

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

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

My first problem of Dynamic Programming

Logic: max (total_1s + max (number_of_0s_in_subarray))

The key to solve this problem is to make use of Kadane's Algorithm. Kadance's Algorithm basically is used to find the maximum sum in a contiguous subarray of an array.

Click here for link for Kadane's Algorithm Explanation

Also, important point to note is that : In input, atleast one number 0 is required for flipping purposes, but if all are 1s in input, then answer will be (total_1s — 1) because atleast one number should be flipped.

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

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

Автор shyam81295, 10 лет назад, По-английски

I have runtime error in 9677279 but it is working on my codeblocks. I cant figure out the problem.

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

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