Print All Possible Words from Phone Digits

Print all possible words from phone number digits. This question is asked by companies like microsoft, google, facebook, Amazon. Lets see example input/output to understand this problem. For example if input number is 234, possible words which can be formed are (Alphabetical order): adg adh adi aeg aeh aei afg afh afi bdg bdh bdi Read More →

String Decode Problem

Problem: If a=1, b=2, c=3,….z=26. Given a string, find all possible codes that string can generate. Give a count as well as print the strings. For example: Input: “1123″. You need to general all valid alphabet codes from this string. Output List aabc //a = 1, a = 1, b = 2, c = 3 Read More →

Microsoft Interview Questions – Set 8 (Intern + Full Time Employee)

15 MCQs on c/c++ output based, 1 java questions was also there. F2F Interview Round 1: Q1. The interviewer first discussed about my projects, specially my data mining project. Q2. Convert a Binary Tree to Doubly Link List in place? Round 2: Q1. One DBMS query select 2nd max salary from table, Q2. OS questions Read More →

Amazon Interview Questions – Set 13 (On campus)

Round 1 (Online test : MCQ+Coding) -Online on Hackerrank Coding Questions: Q1. Print all possible words from phone digits? Q2. Given a matrix where elements are inserted as 1 to n in row 0, n+1 to 2n in row 1 and so on till n^2 and you traverse the matrix in spiral manner, find the Read More →

Euler’s Totient Function

Euler Function: In number theory, Euler’s totient function (or Euler’s phi function), denoted as φ(n) or ϕ(n), is an arithmetic function that counts the positive integers less than or equal to n that are relatively prime to n , i.e., the numbers whose GCD (Greatest Common Divisor) with n is 1. (These integers are sometimes Read More →

Euclid’s Algorithm (Greatest Common Divisor) – GCD

Given two non-negative integers a and b. We need to find their greatest common divisor (GCD), ie, the largest number that divides both a and b. When it is of the numbers is zero, and the other is non-zero, their greatest common divisor, by definition, it is the second number. When both numbers are zero, Read More →

How Long Was He Walking

Puzzle: Every day, Jack arrives at the train station from work at 5 pm. His wife leaves home in her car to meet him there at exactly 5 pm, and drives him home. One day, Jack gets to the station an hour early, and starts walking home, until his wife meets him on the road. Read More →

Top 10 Logic Puzzles

So you think you are clever, right? Then here is your chance to pit your brain against some of the world’s hardest logic puzzles ever created. 1. 10 identical bottles of pills We have 10 identical bottles of identical pills (each bottle contain hundred of pills). Out of 10 bottles 9 have 1 gram of Read More →

Count Total Set Bits in All Numbers From 1 to N

Problem: Given a positive integer n, count the total number of set bits in binary representation of all numbers from 1 to n. Examples: Input: n = 3 Output: 4 Input: n = 6 Output: 9 Input: n = 7 Output: 12 Input: n = 8 Output: 13 Solution: The solution is to run a Read More →

Snapdeal Interview Questions – Set 4

Software Development Engineer In Test Interview I applied through a recruiter. The process took 1 day. I interviewed at Snapdeal (Gurgaon, Haryana). 2 Round was on developing the automation framework approaches and general java based algorithm to some complex variations to puzzle you. Q1. Find the first non repetitive element in an array. Q2. Implement Read More →

Shopclues Interview Questions – Set 1

Hi my name is Surender. Shopclues recently visited our campus for recruitment.I’m mentioning below there interview process and the interview questions asked. Three Rounds(1 written + 2 interviews) Round 1 (Written Test) It consisted of eleven aptitude questions which were to be solved in one hour. For software profile there were five more questions based Read More →

2 Player and N Coin – Strategy Puzzle

Puzzle: There are n coins in a line. (Assume n is even). Two players take turns to take a coin from one of the ends of the line until there are no more coins left. The player with the larger amount of money wins. Would you rather go first or second? Does it matter? Assume Read More →