Founded in 2000, MAQ Software is a company of digital marketing and analytics. MAQ Software serves in various industries which include technology, energy, retail, and healthcare. The company mainly focuses on three sectors that are Artificial Intelligence, Data Analytics, and Cloud.
It has got a 4.2* rating on Glassdoor and is considered one of the best product-based companies. It is highly regarded for its work-life balance.
They provide good training as well which will be beneficial in future too. You can practice the below questions collected from MAQ Interview Experience for the interview. We have collected past frequently asked questions from MAQ Interview Experience for your reference.
Categories of Questions
MAQ Array Questions
Question 1. Maximum Consecutive Numbers Present in an Array Problem Statement Suppose you have an array of integers of size N. The problem “Maximum consecutive numbers present in an array” asks to find out the maximum count of consecutive numbers that could be scattered in an array. Example arr[] = {2, 24, 30, 26, 99, 25} 3 Explanation: The ...
Question 2. Move all negative elements to one side of array Move all negative elements to one side of array – Suppose you have an array of integers. It consists of both negative and positive numbers and the problem statement asks to shift/move all the negative and positive elements to the left of the array and to the right of the ...
Question 3. Find top three repeated in array The problem “Find top three repeated in array” states that you are given an array of n numbers with some repeated numbers in it. Your task is to find out the top 3 repeated numbers in an array. Example [1,3,4,6,7,2,1,6,3,10,5,7] 1 3 6 Explanation Here 1,3 and 6 are repeated ...
Question 4. Sorting using trivial hash function The problem “Sorting using trivial hash function” states that you are given an integer array. An array can be containing both negative and positive numbers. The problem statement asks to sort the array using Trivial Hash Function. Example arr[] = {5,2,1,3,6} {1, 2, 3, 5, 6} arr[] = {-3, -1, ...
Question 5. Find duplicates in a given array when elements are not limited to a range The problem “Find duplicates in a given array when elements are not limited to a range” states that you have an array consisting of n integers. The problem statement it to find out the duplicate elements if present in the array. If no such element exists return -1. Example [ ...
Question 6. Check if two arrays are equal or not The problem “Check if two arrays are equal or not” states that you are given two arrays. The problem statement says that you have to determine if given arrays are equal or not. Example arr1[] = { 1, 4, 2, 5, 2 }; arr2[] = { 2, 1, 5, 4, ...
Question 7. Bubble sort using two Stacks Problem Statement The problem “Bubble sort using two Stacks” states that you are given an array a[ ] of size n. Create a function to sort the given array a[ ] using a bubble sort paradigm with two stack data structures. Example a[ ] = {15, 12, 44, 2, 5, ...
Question 8. Growable array based stack Problem Statement Growable array-based stack is used in cases of “stack full”. Here the old array is replaced with the new bigger one. The size of the new array is decided using these two strategies- Tight Strategy – In this case, a constant amount say c is added to the ...
Question 9. Find the first repeating element in an array of integers Problem Statement Find the first repeating element in an array of integers problem states that you are given an array of integer. It asks to find out the first repeating element from the array and print that number. Example arr[] = {2,6,9,3,1,9,1} 9 Explanation: In the given array there are ...
Question 10. Most Frequent Element in an Array You are given an array of integers. The problem statement says that you have to find out the most frequent element present in an array. If there are multiple values that occurs the maximum number of times, then we have to print any of them. Example Input [1, 4,5,3,1,4,16] Output ...
Question 11. Change the Array into Permutation of Numbers From 1 to N In this problem, we have given an array A of n elements. We need to change the array into a permutation of numbers from 1 to n using minimum replacements in the array. Example Input: 2 2 3 3 Output: 2 1 3 4 Input : 3 2 1 7 ...
Question 12. Rotate Array Rotate array is a problem in which we have given an array of size N. We have to rotate the array in the right direction. Each element shift by one position right and last element of the array come to the first position. So, we have given a value K ...
Question 13. Insertion Sort Sort a given unsorted array using the insertion sort algorithm. Input: {9,5,1,6,11,8,4} Output: {1,4,5,6,8,9,11} Theory Insertion Sort sorts numbers in the same way as we humans sort a set of numbered objects (ex cards) A number is taken from an unsorted array (right subarray) to a position in the sorted ...
Question 14. Subtraction of Two Matrices Problem Statement In the “Subtraction of Two Matrices” problem, we have given two matrices a and b. We have to find the final matrix after subtracting matrix b from matrix a. If the order is the same for both the matrices then only we can subtract them otherwise we can’t. ...
Question 15. Sort 0s 1s and 2s in an Array Problem Statement Given an array containing N elements where elements of the array are 0,1 or 2. Sort or Segregate 0s 1s and 2s in an array. Arrange all zeros in the first half, all ones in the second half and all twos in the third half. Example Input 22 ...
Question 16. Find all Common Elements in Given Three Sorted Arrays Problem Statement In find all common elements in given three sorted arrays problem, we have given three sorted arrays and you have to find common numbers that is present in all three arrays. Example Input: ar1[] = {1, 5, 10, 20, 40, 80} ar2[] = {6, 7, 20, 80, 100} ...
Question 17. Print All Distinct Elements of the Array Problem Statement We have an array of containing N integers which may be positive or negative. We have to print all distinct elements of the array. In other words, we can say that if a number occurs more than one time then we print only that number once. Example Input ...
Question 18. Find the First and Second Smallest Elements Problem Statement In find the first and second smallest elements problem we have given an array of integers. Find the first and second smallest integers from an array or find two smallest numbers from an array. Example Input 7, 6, 8, 10, 11, 5, 13, 99 Output First Smallest is ...
MAQ String Questions
Question 19. Reverse Integer Problem Statement “Reverse Integer” problem states that you are given an integer variable n containing the number to be reversed. Write a program to reverse its digits. Reversing an integer is nothing different from reversing a string. We can easily convert an integer into a string. And then use the ...
Question 20. Reverse words in a string Problem Statement “Reverse words in a string” states that you are given a string s of size n. Print the string in reverse order such that the last word becomes the first, second last becomes the second, and so on. Hereby string we refer to a sentence containing words instead ...
Question 21. Reverse a String Problem Statement “Reverse a String” problem states that you are given a string s of size n. Write a program to reverse it. So, what does reversing a string means? It generally means reversing the input string that we are given. That is it is defined as an operation doing ...
Question 22. Convert String To Int Convert string to int, requires us to convert a numeric string given to an integer. Here we are assuming, we are provided with a numeric string without white spaces either in the middle of the characters or at any one of the ends. We are also assuming that the string ...
Question 23. Mobile Numeric Keypad Problem Problem Statement In the mobile numeric keypad problem, we consider a numeric keypad. We need to find all number of possible numeric sequences of given length such that you are only allowed to press buttons which are top, down, left, and right of the current button. You are not allowed ...
Question 24. Valid Palindrome Given a string s of length n. Write a program to find if the string is valid palindrome or not. If not you may delete at most one character from the string to make it a palindrome. Any string which is the same as it’s reverse is known as a ...
Question 25. KMP Algorithm KMP(Knuth-Morris-Pratt) algorithm is used for pattern searching in a given string. We are given a string S and a pattern p, our goal is to determine whether or not the given pattern is present in the string. Example Input: S = “aaaab” p = “aab” Output: true Naive Approach The ...
Question 26. Rabin Karp Algorithm Rabin Karp Algorithm used to find the pattern string in the given text string. There are so many types of algorithms or methods used to find the pattern string. In this algorithm, we use Hashing for finding the pattern matching. If we got the same hash code for the substring ...
Question 27. Program to Toggle all Characters in a String Problem Statement In the “Program to Toggle all Characters in a String” problem we have given a string, write a program to toggle all characters of the given string. Here toggle means converting all the uppercase characters to lowercase and all lowercase characters to uppercase characters. Input Format The first ...
Question 28. Palindrome using Recursion Problem Statement In the “Recursive Palindrome Check” or “Palindrome using Recursion” problem we have given a string “s”. We have to write a program to check if the given string is palindrome or not using recursion. A palindrome is a word, number, phrase, or other sequence of characters that reads ...
Question 29. Minimum Characters to be Removed to Make a Binary String Alternate Problem Statement Given a binary string, write a program that will find the minimum number of characters that can be removed from this string so that it becomes alternate. A binary string is said to be alternate if there are no consecutive 0’s or 1’s Input Format The first line ...
Question 30. Perfect Reversible String Problem Statement In the “Perfect Reversible String” problem we have given a string “s”. Check that if reverses of all possible substrings of the input string are present in the string or not. If present it’s a perfectly reversible_string. Input Format The first and only one line contain a string ...
Question 31. Sum of numbers in String In this question, we will learn how to calculate the Sum of numbers in String Problem Statement In the “Calculate Sum of all Numbers Present in a String” problem we have given a string “s”. This string contains some alphanumeric numbers and some English lowercase characters. Write a program that ...
Question 32. Remove Extra Spaces from a String Problem Statement In the “Remove Extra Spaces from a String” problem we have given a string “s”. Write a program to remove all extra_spaces from the given string. Input Format The first and only one line containing a string s with some spaces. Output Format Print a string after removing ...
MAQ Tree Questions
Question 33. Binary Search Tree Search and Insertion Problem Statement Write an algorithm to perform searching and insertion in Binary Search Tree. So what we are going to do is insert some of the elements from input into a binary search tree. Whenever asked to search a particular element, we’ll be searching it among the elements in BST(short ...
Question 34. Symmetric Tree In Symmetric Tree problem we have given a binary tree, check whether it is a mirror of itself. A tree is said to be a mirror image of itself if there exists an axis of symmetry through a root node that divides the tree into two same halves. Example Types ...
Question 35. Tree Traversal (Preorder, Inorder & Postorder) First, we need to know about what is Traversal in Binary Tree. Traversal is a type of method in which we visit all the nodes exactly once in some specific manner/order. Basically there are two types of traversal in Binary Tree: Breadth-First Traversal Depth First Traversal We already know about ...
Question 36. Binary Tree Data Structure In this article, we will read about the Binary Tree Data Structure. Trees are hierarchical data structures where every node has a parent node except the root node. The nodes with no child are called leaves. Need for Trees? 1. Trees are used when we need to store data in ...
Question 37. Types of Binary Tree Before we proceed, we first know what BT really is? Binary Tree is a type of data structure that is hierarchical in nature. A BT is represented by nodes where every node has left, a right pointer, and data as the weight of node. Each node can contain a maximum ...
Question 38. BFS vs DFS for Binary Tree Breadth First Search (BFS) Do we already know about what actually BFS is? if not then don’t need to feel bad just read the whole article and visit our previous article on Breadth First Search for better understanding. BFS is a level order traversal in which we visit the nodes of ...
MAQ Graph Questions
Question 39. Depth First Search (DFS) for a Graph Depth First Search is a traversing or searching algorithm in tree/graph data structure. The concept of backtracking we use to find out the DFS. It starts at a given vertex (any arbitrary vertex) and explores it and visit the any of one which is connected to the current vertex and start ...
Question 40. Graph and its representation A graph is an abstract data type representing relations or connections between objects(like cities are connected by rough road). In the graph and its representation, basically, the relation is denoted by edges and objects by vertices(nodes). A graph consists of a finite set of vertices and edges. A graph is ...
MAQ Stack Questions
Question 41. Reverse a stack without using extra space in O(n) Problem Statement The problem “Reverse a stack without using extra space in O(n)” states that you are given a stack data structure. Reverse the given stack without using extra O(n) space. Example 5 4 3 2 1 1 2 3 4 5 80 60 10 20 20 10 60 80 ...
Question 42. Implement a stack using single queue Problem Statement The problem “Implement a stack using single queue” asks us to implement a stack (LIFO) data structure using a queue (FIFO) data structure. Here LIFO means Last In First Out while FIFO means First In First Out. Example push(10) push(20) top() pop() push(30) pop() top() Top : 20 ...
Question 43. Check if a queue can be sorted into another queue using a stack Problem Statement The problem “Check if a queue can be sorted into another queue using a stack” states that you are given a queue containing n elements, the elements in the queue are a permutation of numbers 1 to n. Check if this queue can be arranged in increasing order ...
Question 44. Implement Stack and Queue using Deque Problem Statement The problem “Implement Stack and Queue using Deque” states to write an algorithm to implement Stack and Queue using a Deque(Doubly Ended Queue). Example (Stack) Push(1) Push(2) Push(3) Pop() isEmpty() Pop() Size() 3 false 2 1 Example (Queue) Enqueue(1) Enqueue(2) Enqueue(3) Dequeue isEmpty() Size() Dequeue() 1 false 2 ...
Question 45. Growable array based stack Problem Statement Growable array-based stack is used in cases of “stack full”. Here the old array is replaced with the new bigger one. The size of the new array is decided using these two strategies- Tight Strategy – In this case, a constant amount say c is added to the ...
Question 46. Reverse a Number Using Stack In reverse a number using stack problem we have given an integer variable representing a number. Print the reverse the given number using stack. Example Input : 12345 Output : 54321 Input : 207 Output : 702 Explanation for Reverse a Number Using Stack Let number n = 12345 Start traversing and store the ...
Question 47. Queue using Stacks In queue using a stack problem, we have to implement the following functions of a queue using the standard functions of stack data structure, Enqueue: Add an element to the end of the queue Dequeue: Remove an element from the start of the queue Example Input: Enqueue(5) Enqueue(11) Enqueue(39) Dequeue() ...
Question 48. Iterative Tower of Hanoi Tower of Hanoi is a mathematical puzzle. In this puzzle, we are required to shift all the disks from rod/pole A to rode/pole B using rod/pole C. The disks should be arranged in ascending order i.e the smallest one on top. The transfer of disks from one pole to another ...
Question 49. The Stock Span Problem This problem “The Stock Span Problem” comes under the financial aspect. In this problem, we find the stock span for the stock price of each day. The maximum number of consecutive days just before any particular day for which the price of the stock of the days before it is ...
Question 50. Tower Of Hanoi Tower of Hanoi is a mathematical problem with the following conditions: There are three towers There may be n number of rings present The rings are of different sizes Only one disk can be moved at a time Any disk can only be moved on the top of a bigger ...
Question 51. Recursion What is Recursion? Recursion is simply defined as a function calling itself. It uses its previously solved sub-problems to compute a bigger problem. It is one of the most important and tricky concepts in programming but we can understand it easily if we try to relate recursion with some real ...
MAQ Queue Questions
Question 52. Implement a stack using single queue Problem Statement The problem “Implement a stack using single queue” asks us to implement a stack (LIFO) data structure using a queue (FIFO) data structure. Here LIFO means Last In First Out while FIFO means First In First Out. Example push(10) push(20) top() pop() push(30) pop() top() Top : 20 ...
Question 53. Check if a queue can be sorted into another queue using a stack Problem Statement The problem “Check if a queue can be sorted into another queue using a stack” states that you are given a queue containing n elements, the elements in the queue are a permutation of numbers 1 to n. Check if this queue can be arranged in increasing order ...
Question 54. Priority Queue using doubly linked list Problem Statement The problem “Priority Queue using doubly linked list” asks to implement the following functions of priority queue using doubly linked list. push(x, p) : Enqueue an element x with priority p in the priority queue at appropriate position. pop() : Remove and return the element with highest priority ...
Question 55. Implement Stack and Queue using Deque Problem Statement The problem “Implement Stack and Queue using Deque” states to write an algorithm to implement Stack and Queue using a Deque(Doubly Ended Queue). Example (Stack) Push(1) Push(2) Push(3) Pop() isEmpty() Pop() Size() 3 false 2 1 Example (Queue) Enqueue(1) Enqueue(2) Enqueue(3) Dequeue isEmpty() Size() Dequeue() 1 false 2 ...
Question 56. Sorting a Queue without Extra Space In sorting a queue without extra space problem we have given a queue, sort it using standard queue operations without extra space. Examples Input queue = 10 -> 7 -> 2 -> 8 -> 6 Output queue = 2 -> 6 -> 7 -> 8 -> 10 Input queue = ...
Question 57. Queue using Stacks In queue using a stack problem, we have to implement the following functions of a queue using the standard functions of stack data structure, Enqueue: Add an element to the end of the queue Dequeue: Remove an element from the start of the queue Example Input: Enqueue(5) Enqueue(11) Enqueue(39) Dequeue() ...
Question 58. Circular Queue A circular queue is an advanced form of a linear queue. In the linear queue, we can’t insert an element in the queue if the rear is pointing to the last index of the queue and the queue is not completely filled. This causes wastage of memory. To overcome this ...
MAQ Matrix Questions
Question 59. Mobile Numeric Keypad Problem Problem Statement In the mobile numeric keypad problem, we consider a numeric keypad. We need to find all number of possible numeric sequences of given length such that you are only allowed to press buttons which are top, down, left, and right of the current button. You are not allowed ...
Question 60. Subtraction of Two Matrices Problem Statement In the “Subtraction of Two Matrices” problem, we have given two matrices a and b. We have to find the final matrix after subtracting matrix b from matrix a. If the order is the same for both the matrices then only we can subtract them otherwise we can’t. ...
MAQ Other Questions
Question 61. Total Numbers With no Repeated Digits in a Range You are given a range of numbers (start, end). The given task says to find out the total numbers of numbers with no repeated digits in a range. Example Input: 10 50 Output: 37 Explanation: 10 has no repeated digit. 11 has a repeated digit. 12 has no repeated digit. ...
Question 62. Write a function to get the intersection point of two Linked Lists Problem Statement The problem “Write a function to get the intersection point of two Linked Lists” states that you are given two linked lists. But they are not independent linked lists. They are connected at some point. Now you need to find this point of intersection of these two lists. ...
Question 63. Delete a Node from linked list without head pointer Problem Statement The problem “Delete a Node from linked list without head pointer” states that you have a linked list with some nodes. Now you want to delete a node but you don’t have its parent node address. So delete this node. Example 2->3->4->5->6->7 Node to be deleted: 4 2->3->5->6->7 ...
Question 64. Print the Fibonacci numbers in reverse order Problem Statement Given a number n, print the fibonacci numbers in reverse order. Example n = 5 3 2 1 1 0 Explanation: The Fibonacci numbers are 0, 1, 1, 2, 3 as per their ordering. But since we needed to print in reverse order. n = 7 8 5 ...
Question 65. Print Fibonacci sequence using 2 variables Problem Statement The problem “Print Fibonacci sequence using 2 variables” states that you need to print the Fibonacci sequence but there is a limitation of using only 2 variables. Example n = 5 0 1 1 2 3 5 Explanation The output sequence has the first five elements of the ...
Question 66. Palindrome Number Problem Statement the problem “Palindrome Number” states that you are given an integer number. Check if it is a palindrome or not. Solve this problem without converting the given number into a string. Example 12321 true Explanation 12321 is a palindrome number because when we reverse 12321 it gives 12321 ...
Question 67. Linked List Cycle Problem Statement “Linked List Cycle” problem states that you are given a linked list. Find if it contains any loop or not? Linked list with cycle Example 1->2->3 No Loop Explanation: The linked list does not contain any loop because if it did then there would’ve been two no des ...
Question 68. Seconds to Days Problem Statement “Seconds To Days” problem states that you are given an integer s referring to the seconds. Print the corresponding number of the days, hours, minutes, and seconds. Example s = 1543765 17dd 20hh 49mm 25ss Explanation: Converting the given input into the required format. We get 17 d, ...
Question 69. Special Number What can be so special about a number? Let us find out. We have with us an array of N numbers. A number can be special if it is divisible by one or more numbers except for the number itself. Firstly let us clear this with a few examples before ...
Question 70. OSI Model This model was developed in 1983 by the International Standards Organization (ISO). This was the first step taken to standardized the international protocols used in various layers. As it deals with connecting open systems, that is, systems that are open for communication with other systems, the model is called the ...
Question 71. Sieve of Eratosthenes Sieve of Eratosthenes is an algorithm in which we find out the prime numbers less than N. Here N is an integer value. This is an efficient method to find out the prime numbers to a limit. By using this we can find out the prime numbers till 10000000. Here ...
Question 72. N queen problem N queen problem using the concept of Backtracking. Here we place queen such that no queen under attack condition. The attack condition of the queens is if two queens are on the same column, row, and diagonal then they are under attack. Let’s see this by the below figure. Here ...
Question 73. Fibonacci numbers Fibonacci numbers are the numbers that form the series called Fibonacci series and are represented as Fn. The first two Fibonacci numbers are 0 and 1 respectively i.e. F0=0 and F1=1. Starting from the third Fibonacci number each Fibonacci number is the sum of its previous two numbers in the ...
Question 74. Dynamic Programming Basics In Dynamic Programming basics, we will cover the basics of DP and its differences from the Greedy method, Divide and Conquer and Recursion. Dynamic programming is an approach just like recursion and divide and conquer. It divides the problem into subproblems. But instead of solving these subproblems independently like divide ...
Question 75. Find Nth Node Problem Statement In the “Find Nth Node” problem we have given a linked list to find the nth node. The program should print the data value in the nth node. N is the input integer index. Example 3 1 2 3 4 5 6 3 Approach Given a linked list ...