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

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

I was trying to solve Another Problem On Strings using two pointers since it was mentioned in its tags but I am not getting an idea of it. I have solved it by using hashing and binary search by considering the prefix sum. It will be helpful if one can give some idea of approaching it with two pointers.

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

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

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

I was trying to solve this problem on spoj that involves LCS with some other constraints. I have come with a recursive solution which gives correct answer on all cases. But when I try to memoziate it, it gives wrong answer. I am not able to figure out why it gives wrong answer on memoziation. my code is here with explanation.

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

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

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

I am trying to solve this on spoj. I have first precomputed the index for both the case(appending number to beginning and appending number to end). Then, I used top down approach to find the minimum value. It works on most test cases but gives wrong answer on spoj. I am not able to figure out the reason. Please help. My Soloution

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

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

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

Problem I am trying to solve this problem by finding the region to which x or y belong. I am maintaining a set of all the regions that are available. First, I find to which set x or y belong and delete that set. Two new sets are created. I am keeping the "cut distance" in a set container. But I am getting TLE on test case 11. I ma using only logarithmic data structures. My Code

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

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

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

I am trying to create a link list. I wanted to know how these two codes are different? Code1: if (start == NULL) { start = newnode; } else { temp = start; while(temp != NULL) { temp = temp->next; }

temp = newnode;

}

Code2: if (start == NULL) { start = newnode; } else { temp = start; while(temp->next != NULL) { temp = temp->next; }

temp->next = newnode;
    }

}

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

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

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

I am trying to solve this problem on spoj where we have to output those words which have a certain prefix in it. I used trie data structure for it. But I am getting wrong answer again and again. My solution is here.

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

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

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

I was trying to apply the divide and conquer algorithm for closest pair of points on this problem. I have been getting wrong answer many times. My solution is here. I read this algorith from this site.

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

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

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

I am trying to solve this question from many days but getting wrong answe always. I am using a trie to solve this. My code is here.

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

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