Examples. There is one FB user in India and another in the US. When they communicate, do they connect to the same server? If not then how does the communication happen? What is the data that is being transferred? This round felt like a stress test and went very badly. Couldn’t ask for any good questions when he offered. (My suggestion will be, answer only if you know and you are sure about it otherwise don’t even try)
Written: Aptitude: Objective 50 min 45 questions LR- 2 passages-5 each DI- 1 paragraph- 5 each Mathematical
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Easy only. Just time concern for those who are out of touch. My suggestion will be to do the LR in the end.
If you’re given a string, discover all substrings that are palindromes.
int find_palindromes_in_sub_string(const string& input, int j, int k) {
  int count = 0;
  for (; j >= 0 && k < input.length(); --j, ++k) {
    if (input[j] != input[k]) {     Â
      break;
    cout << input.substr(j, k - j + 1) << endl;
  int count = 0;
  for (int i = 0; i < input.length(); ++i) {   Â
    count += find_palindromes_in_sub_string(input, i – 1, i + 1);
    count += find_palindromes_in_sub_string(input, i, i + 1);
  string str = “aabbbaa”;
  cout << "Total palindrome substrings: " << find_all_palindrome_substrings(str) << endl;
For every letter in the input string, expand to the left and right and check for even and odd length palindromes. Move to the next letter if you know a palindrome doesnt exist.
Expand one character to the left and right, and then, compare them. If both of the characters are equal, print out the palindrome substring.Â
If you’re given a dictionary of words and an input string, find out whether the input string can be segmented into dictionary words.
n = length of input string
for i = 0 to n – 1
  first_word = substring (input string from index [0, i] )
  second_word = substring (input string from index [i + 1, n – 1] )
  if dictionary has first_word
    if second_word is in dictionary OR second_word is of zero length, then return true
    recursively call this method with second_word as input and return true if it can be segmented
The algorithm computes two strings from scratch in every iteration of the loop. Worst case scenario, there will be a recursive call of the second_word each time. This shoots the time complexity up to 2n.Â
You will see that you might be calculating the same substring multiple times, even if it doesnt exist in the dictionary. This can be fixed by memoization, where you can remember the substrings that have already been solved.
In order to achieve memoization, you will be able to store the second string in a new set each time. This will decrease time and memory complexities.
Build a deep copy of the given linked list where each node has two pointers: ‘next’ and ‘arbitrary_pointer’.
This approach utilizes a map to track arbitrary nodes found by the primary list. You will have to create a deep copy of the primary linked list (say list_orig) in two passes.