WatchGuard Technologies
20+ Classic Marble Company Interview Questions and Answers
Q1. Party Over: Sorting Strings Problem
Help Ninja sort the provided list of strings according to a specific condition given by a monster. The condition is to sort the strings based on the last letter. If two strin...read more
Sort the list of strings based on the last character, then second last character, and so on.
Iterate through each string in the list
Sort the strings based on the last character first, then second last character, and so on
Use a custom sorting function to achieve the required sorting order
Q2. Distinct Elements in K-Sized Windows
The task is to determine the number of distinct elements in every sliding window of size 'K' across an array 'ARR' of size 'N'. A 'K' sized window is a contiguous sequence o...read more
Calculate the count of distinct elements in each sliding window of size 'K' across an array 'ARR'.
Use a sliding window approach to iterate through the array and keep track of distinct elements using a hashmap or set.
Update the count of distinct elements in each window as it slides across the array.
Return the array detailing the count of distinct elements in each 'K' sized window for each test case.
Q3. Treasure Hunt Problem Statement
Alex and Rome are engaged in a treasure hunt game. Rome has a treasure box that Alex aims to open, using one of the N uniquely numbered keys placed by Rome in boxes numbered sequ...read more
Given a list of key numbers in sequentially numbered boxes, help Alex determine the box containing the correct key.
Iterate through the list of key numbers and compare each with the target key number.
Use binary search for efficient search in the sorted list of key numbers.
Return the box number if the correct key is found, otherwise indicate that it is not present.
Q4. Covid Vaccination Distribution Problem
As the Government ramps up vaccination drives to combat the second wave of Covid-19, you are tasked with helping plan an effective vaccination schedule. Your goal is to ma...read more
Maximize vaccines administered on a specific day while following certain rules.
Iterate through each test case and calculate the maximum number of vaccines distributed on the specified day.
Distribute vaccines in a way that the difference between consecutive days is at most 1 and the total does not exceed the maximum allowed.
Ensure to maximize the number of vaccines administered on the specified day.
Return the maximum number of vaccines administered on the specified day for eac...read more
Q5. Reverse the String Problem Statement
You are given a string STR
which contains alphabets, numbers, and special characters. Your task is to reverse the string.
Example:
Input:
STR = "abcde"
Output:
"edcba"
Input...read more
Reverse a given string containing alphabets, numbers, and special characters.
Iterate through the string from end to start and append each character to a new string.
Alternatively, use built-in functions like reverse() or slicing to reverse the string.
Handle special characters and numbers while reversing the string.
Ensure to consider the constraints on the length of the string and number of test cases.
Q6. Move Zeros to Left Problem Statement
Your task is to rearrange a given array ARR
such that all zero elements appear at the beginning, followed by non-zero elements, while maintaining the relative order of non-z...read more
Rearrange an array such that all zero elements appear at the beginning, followed by non-zero elements, maintaining relative order of non-zero elements.
Iterate through the array and maintain two pointers - one for the next position to place a zero and one for the next non-zero element.
Swap the elements at these pointers until all zeros are moved to the left and non-zero elements are in their relative order.
Time complexity: O(N), Space complexity: O(1)
Example: Input: [1, 1, 0, ...read more
Mirror Diagonals Problem Statement
Ninja has a square 2D array arr
of size N x N
. Your task is to determine if the numbers on the left diagonal are the same as those on the right diagonal of the matrix.
Input:
Check if the numbers on the left diagonal are the same as those on the right diagonal of a square matrix.
Iterate through the matrix to compare the numbers on the left and right diagonals.
Keep track of the numbers on both diagonals and check for equality.
Return 'true' if the diagonals are equal, otherwise return 'false'.
Q8. MergeSort Linked List Problem Statement
You are given a Singly Linked List of integers. Your task is to sort the list using the 'Merge Sort' algorithm.
Input:
The input consists of a single line containing the ...read more
Sort a Singly Linked List using Merge Sort algorithm.
Implement the Merge Sort algorithm for linked lists.
Divide the list into two halves, sort each half recursively, and then merge them.
Use a fast and slow pointer to find the middle of the list for splitting.
Handle the base cases of empty list or single node list.
Example: Input: 4 3 2 1 -1, Output: 1 2 3 4
Q9. Alpha Pattern Problem Statement
Ninja wants to create a pattern using characters in a specified number of rows ‘N’. The pattern arranges characters in increasing order, such that the first row has 1 character, ...read more
Generate a pattern of characters in increasing order based on the number of rows specified.
Iterate through each row from 1 to N
For each row, print the corresponding character repeated row number of times
Increment the character for each row
SQL query to find the second highest salary from a table
Use the MAX() function to find the highest salary
Use the NOT IN operator to exclude the highest salary from the results
Order the salaries in descending order and limit the result to 1
Q11. What are the types of inheritance
There are 5 types of inheritance: single, multiple, multilevel, hierarchical, and hybrid.
Single inheritance: A class inherits from a single base class.
Multiple inheritance: A class inherits from multiple base classes.
Multilevel inheritance: A class inherits from a derived class, which in turn inherits from another class.
Hierarchical inheritance: Multiple classes inherit from a single base class.
Hybrid inheritance: Combination of multiple and multilevel inheritance.
Q12. Write a code to reverse array in a linked list
Reverses the order of elements in an array stored in a linked list.
Traverse the linked list and store the elements in an array
Reverse the array using two pointers
Update the linked list with the reversed array
Q13. Write a code implementing inheritance
Code implementing inheritance
Inheritance is a concept in object-oriented programming where a class inherits properties and methods from another class
The class that is being inherited from is called the parent class or base class
The class that inherits from the parent class is called the child class or derived class
The child class can access the properties and methods of the parent class
Inheritance promotes code reusability and allows for creating specialized classes based on ...read more
Q14. preorder traversal without using recursion
Iterative solution to perform preorder traversal without using recursion
Use a stack to keep track of nodes
Start by pushing the root node onto the stack
While the stack is not empty, pop a node, visit it, then push its right child followed by its left child onto the stack
Q15. 4 pillars of oops , tcp ip model ,osi model
4 pillars of OOPs are Abstraction, Encapsulation, Inheritance, and Polymorphism. TCP/IP and OSI models are networking models.
Abstraction: Hiding implementation details and showing only necessary information.
Encapsulation: Binding data and functions together and restricting access to them.
Inheritance: Creating new classes from existing ones, inheriting their properties and methods.
Polymorphism: Ability of objects to take on multiple forms or behaviors.
TCP/IP model: Consists of...read more
Q16. virus vs malware, python code for identifying the ip adress
Malware is a broad term that includes viruses, which are a specific type of malware. Python code can be used to identify IP addresses in malware analysis.
Malware is a general term for any type of malicious software, while viruses are a specific type of malware that self-replicates by inserting copies of itself into other computer programs.
Python code can be used to extract and analyze IP addresses from malware samples, helping analysts understand the network infrastructure us...read more
Q17. rotate materix(nxn) 90 degree
To rotate a matrix 90 degrees, transpose the matrix and then reverse each row.
Transpose the matrix by swapping matrix[i][j] with matrix[j][i]
Reverse each row of the transposed matrix to get the final rotated matrix
Q18. what is diamond problem
Diamond problem is a common issue in multiple inheritance where a class inherits from two classes that have a common ancestor.
Occurs in languages that support multiple inheritance like C++
Results in ambiguity when calling methods or accessing attributes from the common ancestor class
Can be resolved using virtual inheritance or interfaces
Q19. run length encoding dsa problem
Run length encoding is a data compression technique that replaces repeated characters with a count and single character.
Iterate through the input array of strings
Count the number of consecutive characters in each string
Replace consecutive characters with count and character
Q20. rotate an array by d times
Rotate an array of strings by d times
Create a new array and copy elements from original array based on rotation index
Use modulo operator to handle cases where d is greater than array length
Handle edge cases like empty array or d being negative
Q21. 5 dsa array string
Implement a data structure for storing and manipulating an array of strings.
Use a dynamic array to store the strings.
Implement functions for adding, removing, and accessing strings in the array.
Consider memory management and resizing the array as needed.
More about working at WatchGuard Technologies
Interview Process at Classic Marble Company
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month