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

Автор dahiyakuldeep304, история, 3 года назад, По-английски

I know how to find all possible trees with given inorder/preorder. But not able to do same given postorder traversal. Anyone please help me. Providing a code will be much help. Thanks.

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

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

Автор dahiyakuldeep304, история, 3 года назад, По-английски

I know how to find all possible trees with given inorder/preorder. But not able to do same given postorder traversal. Anyone please help me. Providing a code will be much help. Thanks.

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

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

Автор dahiyakuldeep304, история, 3 года назад, По-английски

we have an integer N, We have to find the number of all possible distinct binary strings of the length N, which have at least three consecutive 1s. So if n = 4, then the numbers will be 0111, 1110, 1111, so output will be 3.

Can anyone have any idea how to use dynamic programming here. It will be a great help. Thanks for advance.

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

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

Автор dahiyakuldeep304, история, 3 года назад, По-английски

Can anyone please tell me how we approach to this problem.

A drawer contains socks of n different colours. The number of socks available of ith colour is given by a[i] where a is an array of n elements. Tony wants to take k pairs of socks out of the drawer. However, he cannot see the colour of the sock that he is picking. You have to tell what is the minimum number of socks Tony has to pick in one attempt from the drawer such that he can be absolutely sure, without seeing their colours, that he will have at least k matching pairs.

question link-> https://practice.geeksforgeeks.org/problems/620fb6456d6515faddd77050dfbf2821d7a94b8a/1/?track=30-DOC-day-4&batchId=320

Thanks in advance.

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

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

Автор dahiyakuldeep304, история, 3 года назад, По-английски

Number of ways to divide string in sub-strings such to make them in lexicographically increasing sequence. link-> https://www.geeksforgeeks.org/number-of-ways-to-divide-string-in-sub-strings-such-to-make-them-in-lexicographically-increasing-sequence/

can anyone please help me?

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

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