Microsoft Corporation
700+ Axens India Interview Questions and Answers
Q1. Buses Origin Problem Statement
You have been provided with an array where each element specifies the number of buses that can be boarded at each respective bus stop. Buses will only stop at locations that are m...read more
Q2. Chess Tournament Problem Statement
In Ninjaland, a chess tournament is being organized with C
chess players attending. They will all stay in a hotel that has N
available rooms. Each player will choose one room,...read more
Q3. Day of the Week Calculation
Your task is to create a function that determines the day of the week for any given date, whether in the past or the future.
Input:
The first line consists of an integer 'T', represe...read more
Q4. Fruits and Baskets Problem Statement
You are given 'n' fruit trees planted along a road, numbered from 0 to n-1. Each tree bears a fruit type represented by an uppercase English alphabet. A Ninja walking along ...read more
Q5. Word Wrap Problem Statement
You are tasked with arranging 'N' words of varying lengths such that each line contains at most 'M' characters, with each word separated by a space. The challenge is to minimize the ...read more
Q6. Rotational Equivalence of Strings Problem Statement
Given two strings 'P' and 'Q' of equal length, determine if string 'P' can be transformed into string 'Q' by cyclically rotating it to the right any number of...read more
Q7. The Celebrity Problem
Imagine there are 'N' people at a party, each assigned a unique ID from 0 to N-1. A celebrity at the party is a person who is known by everyone but knows no one else.
Problem Statement:
Yo...read more
Q8. Longest Mountain Subarray Problem Statement
Given an array of integers representing the heights of mountains, determine the length of the longest subarray that forms a mountain shape.
A mountain subarray is def...read more
Q9. You are given infinite sequence of continuos natural numbers-1,2,3,4,5,6.......... Initially you delete every 2nd element so sequence will be 1,3,,5,7,9,11,13..... now in the resultant sequence you delete every...
read moreProgram to check if a given number is a lucky number or not.
Create a function that takes an integer n as input
Initialize a variable count to 2
Loop through the sequence and delete every count-th element
Repeat the above step until the end of the sequence
If n is present in the final sequence, return true, else return false
Q10. Data Structure with Insert, Delete, and GetRandom Operations
Design a data structure that supports four operations: insert an element, remove an element, search for an element, and get a random element. Each op...read more
Q11. Nth Term of Geometric Progression (GP) Series
Determine the Nth term of a geometric progression (GP) series given the first term, common ratio, and the term number.
Explanation:
The general form of a GP series ...read more
Q12. Find All Triplets with Zero Sum
Given an array Arr
consisting of N
integers, find all distinct triplets in the array that sum up to zero.
Explanation:
An array is said to have a triplet {Arr[i], Arr[j], Arr[k]}...read more
Q13. Distinct Strings With Odd and Even Swapping Allowed Problem Statement
You are provided with an array of strings, and your objective is to determine the number of unique strings within it.
A string is deemed uni...read more
Q14. Kth Largest Element Problem
Given an array containing N
distinct positive integers and a number K
, determine the Kth largest element in the array.
Example:
Input:
N = 6, K = 3, array = [2, 1, 5, 6, 3, 8]
Output...read more
Q15. Dice Throw Problem Statement
You are provided with D
dice, each having F
faces numbered 1 to F
, inclusive. Your task is to determine the number of possible ways to roll the dice such that the sum of the face-up...read more
Q16. Generate Binary Strings from Pattern
Given a string STR
containing '0', '1', and '?' special characters, generate all possible strings by replacing each '?' with either '0' or '1'.
Input:
The first line contain...read more
Q17. You have a cuboid (m*n*p) each block of the cuboid is having a metallic ball. Now we are passing X-ray from front face and getting a bool matrix1 of m*p the elements are set if there is a black spot.(as we are...
read moreYes, it is possible to get the accurate result from the given data.
The coordinates (i,j,k) where metallic balls are present can be determined by finding the set elements in both matrix1 and matrix2.
Additional data is not required as the given data is sufficient to determine the coordinates.
The coordinates can be obtained by iterating through the elements of matrix1 and matrix2 and checking for set elements.
Q18. Sum of Leaf Nodes at Maximum Level Problem Statement
Given a binary tree of integers, your task is to calculate the sum of all the leaf nodes which are present at the deepest level of the binary tree. If there ...read more
Q19. Palindrome Linked List Problem Statement
You are provided with a singly linked list of integers. Your task is to determine whether the given singly linked list is a palindrome. Return true
if it is a palindrome...read more
Q20. Maximum Subarray Sum Problem Statement
Given an array 'ARR' of integers with length 'N', the task is to determine the sum of the subarray (including an empty subarray) that yields the maximum sum among all poss...read more
Q21. First Missing Positive Problem Statement
You are provided with an integer array ARR
of length 'N'. Your objective is to determine the first missing positive integer using linear time and constant space. This me...read more
Q22. Total Strings Problem Description
Given a positive integer N
, your task is to determine the number of strings of length N
that can be created using only the characters 'a', 'b', and 'c'. The strings must adhere...read more
Q23. Find K’th Character of Decrypted String
You are given an encrypted string where repetitions of substrings are expressed as the substring followed by the count of these substrings. The task is to find the 'K'th ...read more
Q24. Rearrange String Problem Statement
Given a string ‘S’, your task is to rearrange its characters so that no two adjacent characters are the same. If it's possible, return any such arrangement, otherwise return “...read more
Q25. Cycle Detection in a Linked List
Determine if a given Singly Linked List of integers forms a cycle or not.
Explanation:
A cycle occurs when a node's next
points back to a previous node in the list. This means t...read more
Q26. Detect the First Node of the Loop in a Singly Linked List
You are provided with a singly linked list that may contain a cycle. Your task is to return the node where the cycle begins, if such a cycle exists.
A c...read more
Q27. Buy and Sell Stock Problem Statement
You are tasked to help a friend with stock trading for the next 'N' days. He can either buy or sell a stock, with the condition that he can complete at most 2 transactions. ...read more
Q28. Nearest Multiple of 10 Problem Statement
Given an integer N
, find the nearest multiple of 10. If there are multiple nearest multiples, return the smallest one.
Input:
The first line contains an integer 'T', den...read more
Q29. Merge Sort Problem Statement
You are given a sequence of numbers, ARR
. Your task is to return a sorted sequence of ARR
in non-descending order using the Merge Sort algorithm.
Explanation:
The Merge Sort algorit...read more
Q30. Mean, Median, Mode Calculation
You are given an array 'ARR' consisting of 'N' integers. Your task is to calculate the three statistical measures for the given array:
- Mean - Implement the function
mean()
to cal...read more
Q31. Sum Root to Leaf Numbers
You are given an arbitrary binary tree consisting of N nodes, each associated with an integer value from 1 to 9. Each root-to-leaf path can be considered a number formed by concatenatin...read more
Q32. Flatten Binary Tree Problem Statement
Given a binary tree consisting of integer values, your task is to convert the binary tree into a linked list where the nodes of the linked list follow the same order as the...read more
Q33. Look-And-Say Sequence Problem Statement
The Look-And-Say sequence is a series of positive integers generated in a specific pattern:
1, 11, 21, 1211, 111221, 312211, 13112221,...
To construct this sequence:
- The...read more
Q34. Dice Throws Problem Statement
You are given D
dice, each having F
faces numbered from 1 to F
. The task is to determine the number of possible ways to roll all the dice such that the sum of the face-up numbers e...read more
Q35. Check Word Presence in String
Given a string S
and a list wordList
containing N
distinct words, determine if each word in wordList
is present in S
. Return a boolean array where the value at index 'i' indicates ...read more
Q36. IP Address Formation from String
Given a string S
consisting only of digits from 0 to 9, your task is to find all potential IP addresses that can be formed from S
and list them in lexicographical order. If it's...read more
Q37. N Queens Problem
Given an integer N
, find all possible placements of N
queens on an N x N
chessboard such that no two queens threaten each other.
Explanation:
A queen can attack another queen if they are in the...read more
Q38. Distinct Subsequences of a String
Given a string S
of length N
that may contain duplicate alphabets, your task is to compute the count of distinct subsequences of this string.
Example:
Input:
S = "deed"
Output:...read more
Q39. Add Two Numbers Represented by Linked Lists
Given two singly linked lists, each representing a positive number without leading zeros, your task is to add these two numbers. The result should be returned as a li...read more
Q40. Matrix Rank Calculation
Given a matrix ARR
of dimensions N * M
, your task is to determine the rank of the matrix ARR
.
Explanation:
The rank of a matrix is defined as:
(a) The maximum number of linearly independ...read more
Q41. N-Queens Problem Statement
Given an integer N
, your task is to position N
queens on an N x N
chessboard in such a way that no two queens threaten each other.
A queen can attack other queens that are in the same...read more
Q42. Rooms and Keys Problem Statement
Given some information about rooms in a military camp, where rooms are numbered from 0 to 'N-1'. Each room may contain keys to some other rooms. You can only visit a room if you...read more
Rearrange Array to Form Largest Number
Given an array ARR
consisting of non-negative integers, rearrange the numbers to form the largest possible number. The digits within each number cannot be changed.
Input:
Q44. Word Break Problem Statement
You are given a list of N
strings called A
. Your task is to determine whether you can form a given target string by combining one or more strings from A
.
The strings from A
can be u...read more
Q45. Maximum Path Sum Between Two Leaves of a Binary Tree Problem Statement
You are provided with a non-empty binary tree where each node has a non-negative integer value. Compute and return the maximum possible sum...read more
Q46. Stock Buying and Selling Problem Statement
Given an array of stock prices where each element represents the stock price for a given day, determine the maximum profit you can achieve from buying and selling the ...read more
Q47. Construct Binary Tree from Inorder and Preorder Traversal
Given the preorder and inorder traversal sequences of a binary tree, your task is to construct the binary tree using these traversals.
Input:
The input ...read more
Q48. Group Anagrams Problem Statement
Given an array or list of strings called inputStr
, your task is to return the strings grouped as anagrams. Each group should contain strings that are anagrams of one another.
An...read more
Q49. Maximum Stock Profit with Two Transactions
You are provided with the prices of a particular stock over the next ‘N’ days. You can perform at most two transactions to maximize your profit. A transaction consists...read more
Q50. Gray Code Problem Statement
You are given a number grayNumber
. Your task is to find and return the Gray code sequence.
Explanation
The Gray code sequence should satisfy the following conditions:
1. Include numb...read more
Q51. Delete N Nodes After M Nodes in a Linked List
Given a singly linked list and two integers 'N' and 'M', traverse the linked list to retain 'M' nodes and then delete the next 'N' nodes. Continue this process unti...read more
Q52. Simplify Directory Path Problem Statement
You are provided with a directory path in Unix-style notation, and your task is to simplify it according to given rules.
In a Unix-style file system:
- A dot (.) refers ...read more
Q53. Distinct Islands Problem Statement
Given a two-dimensional array/list consisting of integers 0s and 1s, where 1 represents land and 0 represents water, determine the number of distinct islands. A group of conne...read more
Q54. Alternating Largest Problem Statement
Given a list of numbers, rearrange them such that every second element is greater than its adjacent elements. Implement a function to achieve this rearrangement.
Input:
The...read more
Q55. Count Inversions Problem Statement
Let A[0 ... n-1]
be an array of n
distinct positive integers. An inversion of A
is a pair of indices (i, j)
such that i < j
and A[i] > A[j]
. Given an integer array A, your tas...read more
Q56. Time to Burn Tree Problem
You are given a binary tree consisting of 'N' unique nodes and a start node where the burning will commence. The task is to calculate the time in minutes required to completely burn th...read more
Q57. Running Median Problem
Given a stream of integers, calculate and print the median after each new integer is added to the stream.
Output only the integer part of the median.
Example:
Input:
N = 5
Stream = [2, 3,...read more
Q58. Kth Smallest Element Problem Statement
You are provided with an array of integers ARR
of size N
and an integer K
. Your task is to find and return the K
-th smallest value present in the array. All elements in th...read more
Q59. Ninja and the Tree: Correcting a Mistaken Binary Search Tree
Ninja is exploring the data structure of trees and while learning about Binary Search Trees (BST), she created her own. However, she unknowingly swap...read more
Q60. Polynomial Simplification Problem Statement
You are provided with two arrays representing the coefficients and degrees of a polynomial expression. Your task is to simplify this polynomial into its general form ...read more
Q61. Left View of a Binary Tree Problem Statement
Given a binary tree, your task is to print the left view of the tree.
Example:
Input:
The input will be in level order form, with node values separated by a space. U...read more
Q62. Find the Lone Set Bit
Your task is to identify the position of the only '1' bit in the binary representation of a given non-negative integer N
. The representation contains exactly one '1' and the rest are '0's....read more
Q63. Cash Flow Minimization Problem
You are presented with a list of financial transactions among ‘n’ friends, where each transaction specifies who pays whom and how much. The objective is to minimize the cash flow ...read more
Q64. Nth Element of Modified Fibonacci Series
Given two integers X
and Y
as the first two elements of a series, and another integer N
, find the Nth number of the series utilizing the Fibonacci rule: f(x) = f(x - 1) ...read more
Q65. Check Permutation Problem Statement
Determine if two given strings, 'str1'
and 'str2'
, are permutations of each other.
Explanation:
Two strings are permutations of each other if one string's characters can be r...read more
Q66. Count Squares in a Matrix
Given a matrix of size N * M, your task is to count the number of squares present within it.
Since the count can be extremely large, the result should be computed modulo 109 + 7.
Examp...read more
Q67. Convert BST to Sorted Doubly Linked List
You are given a Binary Search Tree (BST), and your task is to convert it into a sorted Doubly Linked List (DLL).
Example:
Consider the provided BST. The goal is to conve...read more
Q68. Spiral Order Traversal of a Binary Tree Problem Statement
Given a binary tree with 'N' nodes, your task is to print the nodes in spiral order traversal.
Example:
Input:
The binary tree is represented in level o...read more
Q69. Which of the following numbers cannot be represented accurately in > binary? > a) 0.1 b) 6.5 c) 1/16 d)1.32 e) 0.590625 (not sure abt option e) > > 1. a only > 2. a and b > 3. a, b and d > 4. a, b and e > (not...
read moreIdentifying which numbers cannot be accurately represented in binary.
Binary cannot accurately represent decimal fractions that do not have a power of 2 as their denominator.
Option a (0.1) and option e (0.590625) cannot be accurately represented in binary.
Option b (6.5) and option d (1.32) can be accurately represented in binary.
Option c (1/16) can be accurately represented in binary as 0.0001.
Q70. Arithmetic Expression Evaluation Problem Statement
You are provided with a string expression
consisting of characters '+', '-', '*', '/', '(', ')' and digits '0' to '9', representing an arithmetic expression in...read more
Q71. Median of Two Sorted Arrays
Given two sorted arrays A
and B
of sizes N
and M
, find the median of the merged array formed by combining arrays A
and B
. If the total number of elements, N + M
, is even, the median ...read more
Q72. Minimum Fountains Activation Problem
In this problem, you have a one-dimensional garden of length 'N'. Each position from 0 to 'N' has a fountain that can provide water to the garden up to a certain range. Thus...read more
Q73. Identical Trees Problem Statement
Given two binary trees with 'N' and 'M' nodes respectively, determine if the two trees are identical. Return true
if they are identical, otherwise return false
.
Input:
The firs...read more
Q74. Minimum Subarray with Required Sum Problem Statement
Given an array of positive integers ARR
and an integer X
, determine the minimum length subarray where the sum of its elements is strictly greater than X
.
Not...read more
Q75. Maximum Meetings Problem Statement
Given the schedule of N meetings with their start time Start[i]
and end time End[i]
, you need to determine which meetings can be organized in a single meeting room such that t...read more
Q76. Delete Kth Node from End of Linked List
This problem requires you to delete the Kth node from the end of a given singly linked list with N nodes containing integer data.
You are asked to efficiently remove this...read more
Q77. Reverse a Linked List Problem Statement
Given a singly linked list of integers, your task is to return the head of the reversed linked list.
Example:
Input:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL.
Out...read more
Q78. Longest Palindromic Subsequence Problem Statement
Ninja receives a PS5 from Santa, locked in a safe with a password. The password is the length of the longest palindromic subsequence in the given string SECRETC...read more
Q79. What are the steps which you will follow if a customer calls and tell you that he is not able to do any editing in Microsoft word?
Steps to follow when a customer reports inability to edit in Microsoft Word
Ask the customer if they are receiving any error messages
Check if the document is in read-only mode
Check if the customer has the necessary permissions to edit the document
Check if the customer's version of Microsoft Word is up to date
Try repairing or reinstalling Microsoft Word
If all else fails, escalate the issue to a higher level of support
Q80. Minimum Number of Platforms Needed Problem Statement
You are given the arrival and departure times of N trains at a railway station for a particular day. Your task is to determine the minimum number of platform...read more
Q81. Tic-Tac-Toe Design Problem
Design a 2-player Tic-Tac-Toe game played on an N
* N
grid where Player 1 uses ‘X’ and Player 2 uses ‘O’. A move is always valid and occupies an empty spot.
If a player places N
of th...read more
Q82. Ways To Make Coin Change
Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more
Q83. You have 3 baskets- one containing apples, one oranges and the last containing both. All baskets are incorrectly labelled.You can pick *one* fruit from *any one* basket and are supposed to correctly label all o...
read morePick a fruit from the basket containing both fruits and label the baskets accordingly.
Pick a fruit from the basket labelled 'apples and oranges'
If you pick an apple, label the basket containing only apples
If you pick an orange, label the basket containing only oranges
Label the remaining basket as containing both fruits
Q84. Longest Common Prefix After Rotation
You are given two strings 'A' and 'B'. While string 'A' is constant, you may apply any number of left shift operations to string 'B'.
Explanation:
Your task is to calculate ...read more
Q85. Pair Sum Problem Statement
You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to find and return a list of all pairs of elements where each sum of a pair equals 'S'.
Note:
Each pa...read more
Q86. Maximum Product Subarray Problem Statement
Given an array of integers, determine the contiguous subarray that produces the maximum product of its elements.
Explanation:
A subarray can be derived from the origin...read more
Q87. Swap Numbers Without Temporary Variable
Your task is to interchange the values of two numbers given as variables 'X' and 'Y' without using a temporary variable or any additional variable.
Explanation:
You need ...read more
Q88. Euler Totient Function Calculation
Determine the count of numbers between 1 and a given integer 'N' (inclusive) that are coprime to 'N'.
Input:
T
, number of test casesN
, the integer for each test case
Output:
T...read more
Q89. Connect Nodes at the Same Level
Given a binary tree where each node has at most two children, your task is to connect all adjacent nodes at the same level. You should populate each node's 'next' pointer to its ...read more
Q90. Minimum Number of Platforms Problem
Your task is to determine the minimum number of platforms required at a railway station so that no train has to wait.
Explanation:
Given two arrays:
AT
- representing the ar...read more
Q91. Water Equalization Problem Statement
You are provided with an array ARR
of positive integers. Each integer represents the number of liters of water in a bucket. The goal is to make the liters of water in every ...read more
Q92. Rat in a Maze Problem Statement
You need to determine all possible paths for a rat starting at position (0, 0) in a square maze to reach its destination at (N-1, N-1). The maze is represented as an N*N matrix w...read more
Q93. Minimize Cash Flow Problem
You are provided with a list of 'transactions' involving 'n' friends who owe each other money. Each entry in the list contains information about a receiver, sender, and the transactio...read more
Q94. A process doesn't require additional processors to carry out 40% of > it's execution since 40% is mostly sequential. Determine how many > additional processors are required to execute the process in 150s if > t...
read moreAdditional processors required to execute a process in 150s with 40% sequential execution.
Process takes 300s on a single processor
40% of the process is sequential and doesn't require additional processors
Calculate the time taken by the remaining 60% of the process
Determine the speedup required to execute the remaining 60% in 150s
Calculate the number of additional processors required based on the speedup
Q95. Longest Duplicate Substring Problem Statement
You are provided with a string 'S'. The task is to determine the length of the longest duplicate substring within this string. Note that duplicate substrings can ov...read more
Q96. Given a string s[1...n] and a reverse function reverse(s, i, k) > which reverses the character sequence from i to k (inclusive of both) > in string s, determine what the following operations result in. > 1 > re...
read moreDetermining the result of string reversal and rotation operations using a reverse function.
The first operation reverses the first half and second operation reverses the second half of the string, resulting in a rotation of the string left k positions.
The third operation reverses the entire string, resulting in a reversal of the string.
Therefore, the correct answer is (b) Rotates the String left k positions.
Example: s = 'abcdefg', k = 3, reverse(s, 1, 3) = 'cbadefg', reverse(s...read more
Q97. Given a string of containing lower case letters and upper case characters. Find the number of occurrences of each character. The question was further modified to include the special characters as well. I was as...
read moreCount the occurrences of each character in a given string including special characters.
Create test cases for empty string
Test for string with only one character
Test for string with all characters being the same
Test for string with all characters being different
Test for string with special characters
Q98. Ninja and the Storyteller Problem
Ninja is eager to listen to stories from the renowned Storyteller of Ninjaland. The storyteller charges 'Y' coins per story. However, for every set of 'X' stories told, Ninja g...read more
Q99. Rotate Matrix by 90 Degrees Problem Statement
Given a square matrix 'MATRIX' of non-negative integers, rotate the matrix by 90 degrees in an anti-clockwise direction using only constant extra space.
Input:
The ...read more
Q100. Minimum Steps for a Knight to Reach Target
Given a square chessboard of size 'N x N', determine the minimum number of moves a Knight requires to reach a specified target position from its initial position.
Expl...read more
More about working at Microsoft Corporation
Top HR Questions asked in Axens India
Interview Process at Axens India
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month