Goldman Sachs OT 2020 August
Anonymous User
2169

So Goldman came to our campus for Final Year students. Three coding questions were as follows -

  1. Given N strings. A string is considered palindromic if the right half of it forms a palindrome upon rearranging. The right half for a string of even length is substring from index N/2 (1 based) to N. The right half of a string of odd length is substring from N/2 -1 to N. Find out the number of such strings.
  2. Given the value of root of a tree(root) ,the Total number of nodes in the tree (N) and the positioning of each node with respect to root ( in the form of N-1 strings of Ls and Rs ) , find the sum of values of all Magic nodes.
    A Magic Node a node which satisifes following properties:-
    a. It has both left and right child.
    b. The left subtree sum and right subtree sum are of different parities (one even , then other odd and vice versa).
    Given Input : N = 7
    Root = 12
    L 17
    R 16
    RL 4
    RLL 2
    RLR 3
    RR 9
  3. A simple Question on implementation of Dijkstra Algo.
Comments (1)