dahiyakuldeep304's blog

By dahiyakuldeep304, history, 3 years ago, In English

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.

Full text and comments »

By dahiyakuldeep304, history, 3 years ago, In English

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.

Full text and comments »

  • Vote: I like it
  • -10
  • Vote: I do not like it

By dahiyakuldeep304, history, 3 years ago, In English

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.

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By dahiyakuldeep304, history, 3 years ago, In English

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.

Full text and comments »

  • Vote: I like it
  • -14
  • Vote: I do not like it

By dahiyakuldeep304, history, 3 years ago, In English

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?

Full text and comments »

  • Vote: I like it
  • -17
  • Vote: I do not like it