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

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

The following question was asked to my friend in an interview : given a string consisting only of '(' and ')'. find total number of substrings with balanced parenthesis Note: the input string is already balanced.

The only solution i can think of this problem is brute force which takes n^3 time. Is there a faster solution possible.If there is then i would also like to know the build up to that approach.

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

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

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

can anyone please provide me with a hint to solve this problem

basically we need to find all the cliques in the graph but in short time.

Update : I tried Bron-Kerbosch algorithm but it takes exponential time and the time limit for the problem is 1 sec with maximum of 128 vertices.

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

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

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

Given a forest with n vertices, add edges to make it into a tree with minimal diameter. I tried many approaches but none of them passed system test cases.Please suggest some algorithm to solve this problem.

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

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

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

i tried to solve codeforces gym problems of a finished round but i am not seeing any option to submit my solution can anyone please help me in this matter

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

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

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

please name some good books on data structures and algorithms with good problem set

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

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

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

i want to know the basic stratey for solving this problem

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

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