K’th Largest Element in BST when modification to BST is not allowed

Given a Binary Search Tree (BST) and a positive integer k, find the k’th largest element in the Binary Search Tree.

      [20]
      /  \     
    [8]  [22] 
    /  \
  [5]  [10]
       /  \
     [9]  [12]

For example, in the following BST, if
if k = 3, then output should be 12
if k = 5, then output should be 9.

Count number of ways to reach a given score in a game

Consider a game where a player can score 3 or 5 or 10 points in a move. Given a total score n, find number of ways to reach the given score.

Examples:

Input: n = 20
Output: 4

Daughter's Age VeryGood Puzzle


Hello folks,

Today I am posting an Interview Puzzle which was asked to my friend in his Interview. This puzzle will be helpful in job interview preparation.

I have also posted many puzzles for interview before, you can read here :

1) 100 doors in a row Visit and Toggle the door. What state the door will be after nth pass ? 

2) 25 horses 5 tracks Find 3 fastest puzzle

3) N Petrol bunks or City arranged in circle. You have Fuel and distance between petrol bunks. Is it possible to find starting point so that we can travel all Petrol Bunks 

Presenting the Brain Teasers.. :D

Two MIT math grads bump into each other at Fairway on the upper west side. They haven’t seen each other in over 20 years.

SAP Off Campus Hiring_ March 2015 Coding Skills

Question # 1

Complete the code to solve the following problem statement
Given two integers N and M (0 <= N <= M <= 10 7), find the sum of digits of all integers from N to M, both inclusive. Example: Input: 1 10 Output: 46

SAP Off Campus Hiring_ March 2015 Computer Skills

Q)What will be the output of the given code?

#include<stdio.h>
#include<conio.h>
void main()
   {
      clrscr();
      int a[5] = {1,2,3,4,5};
       for(int i = 0; i< 5;i+2)  
          printf("%d" ,i++[a]);
          printf(",%d",i);
           getch();
}
2 4 6 ,6
1 4 ,6
1 2 3 4 5 ,5
Compiler Error
None of these

SAP Off Campus Hiring_ March 2015 Verbal Skills

Q1)Rearrange the given phrases to form a meaningful sentence.
(1) seating and the all important photo /(2) liveliest part of the show /(3) the jostling melee of entry, /(4) taking constitutes the /(5) from a layman's perspective,

5 1 4 3 2
5 3 1 4 2
3 5 1 2 4
3 5 2 1 4

SAP Off Campus Hiring_ March 2015 Analytical Aptitude

Q1)Read the information and answer the following questions: Six people are sitting in a circle. Fred is sitting opposite to Bell. Alex is sitting immediately right of Bell but immediately left of Cami. Edie is sitting immediately left of Bell. Dina is sitting immediately right of Fred and immediately left of Edie. Now Cami and Dina exchange positions and then Edie and Bell exchange positions.
Who will be sitting immediate left of Dina?

SAP Hiring Off-Campus General Aptitude

Q1)If 4 children or 2 women can work equally as one man, and 10 children 8 ladies and 8 men can reap 14 fields in 7 days, how many children are needed to reap the 7 fields in the same time?
Choose the best option

26.0
27.0
28.0
29.0
none of these

SAP Off Campus Hiring_ March 2015 Sample Questions

The online test would contain the following sections:

1)    Psychometric Test : Random behavioral 60 question, 10 min.

2)    General Aptitude : 10 question Click Here : http://www.gohired.in/2015/03/sap-hiring-off-campus-general-aptitude.html

3)    Analytical Aptitude : Click Here : http://www.gohired.in/2015/03/sap-off-campus-hiring-march-2015.html

4)    Verbal Skills : Click Here http://www.gohired.in/2015/03/sap-off-campus-hiring-march-2015-verbal.html

5)    Computer Skills : Click Here : http://www.gohired.in/2015/03/sap-off-campus-hiring-march-2015_1.html






6)    Coding Skills : Click Here : http://www.gohired.in/2015/03/sap-off-campus-hiring-march-2015-coding.html

Python Dictionaries

Python dictionaries are also known as associative arrays or hash tables. The general syntax of a dictionary is as follows:

dict = {'Alice': '2341', 'Beth': '9102', 'Cecil': '3258'}
You can create dictionary in the following way as well:

dict1 = { 'abc': 456 };
dict2 = { 'abc': 123, 98.6: 37 };