Add office photos
Employer?
Claim Account for FREE

Times Internet

3.6
based on 666 Reviews
Video summary
Filter interviews by

20+ Ambey Mining Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. Binary Array Sorting Problem Statement

You are provided with a binary array, i.e., an array containing only 0s and 1s. Your task is to sort this binary array and return it after sorting.

Input:

 The first line ...read more
Ans.

Yes, the binary array can be sorted in linear time and constant space using a single traversal.

  • Use two pointers approach to swap 0s to the left and 1s to the right.

  • Maintain two pointers, one for 0s and one for 1s, and iterate through the array once.

  • Example: Input array [1, 0, 1, 0, 1] will be sorted to [0, 0, 1, 1, 1] in a single traversal.

Add your answer

Q2. Largest Prime Factor Problem Statement

You are given a positive integer n. Your task is to identify the largest prime factor of this given positive integer.

If there is no prime factor for a given integer, outp...read more

Ans.

Identify the largest prime factor of a given positive integer.

  • Iterate from 2 to sqrt(n) to find prime factors

  • Check if each factor is prime and update largest prime factor

  • If no prime factor found, output -1

Add your answer

Q3. Clone Linked List with Random Pointer Problem Statement

Given a linked list where each node has two pointers: one pointing to the next node and another which can point randomly to any node in the list or null, ...read more

Ans.

Yes, the cloning of a linked list with random pointer can be accomplished without utilizing extra space.

  • Use a hashmap to store the mapping between original nodes and their corresponding cloned nodes.

  • Iterate through the original linked list to create the cloned nodes and update the hashmap.

  • Iterate through the original linked list again to set the next and random pointers of the cloned nodes using the hashmap.

  • Time complexity: O(N), Space complexity: O(N) where N is the number o...read more

Add your answer

Q4. 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

Ans.

Find the smallest positive integer missing from an array of integers.

  • Iterate through the array and mark positive integers as visited using index as a reference.

  • After marking, iterate again to find the first unmarked index which represents the missing positive integer.

  • Handle edge cases like duplicates and negative numbers appropriately.

  • Example: For input [3, 4, -1, 1], the output should be 2.

Add your answer
Discover Ambey Mining interview dos and don'ts from real experiences

Q5. 20 red balls and 16 blue balls are present in a bag. 2 balls are removed, if they are of the same color, then they are replaced by a red ball. If they are of different color, then they are replaced with a blue...

read more
Ans.

Balls are removed and replaced based on color. Find the last ball remaining.

  • Start with 20 red and 16 blue balls

  • Remove 2 balls and replace based on color

  • Repeat until only one ball remains

Add your answer

Q6. Delete Node in Binary Search Tree Problem Statement

You are provided with a Binary Search Tree (BST) containing 'N' nodes with integer data. Your task is to remove a given node from this BST.

A BST is a binary ...read more

Ans.

Delete a given node from a Binary Search Tree (BST) and return the inorder traversal of the modified BST.

  • Traverse the BST to find the node to be deleted.

  • Handle different cases like node with no children, one child, or two children.

  • Update the pointers of the parent node and child nodes accordingly.

  • Perform inorder traversal after deletion to get the modified BST.

Add your answer
Are these interview questions helpful?

Q7. Binary Search Tree Insertion

Given the root node of a binary search tree and a positive integer, you need to insert a new node with the given value into the BST so that the resulting tree maintains the properti...read more

Ans.

Insert a new node with a given value into a binary search tree while maintaining the properties of a BST.

  • Traverse the BST starting from the root node and compare the value to be inserted with each node's value to determine the correct position for insertion.

  • Insert the new node as a leaf node in the appropriate position to maintain the BST properties.

  • Ensure that the resulting tree is a valid binary search tree by following the properties of a BST.

  • Example: Inserting value 60 in...read more

Add your answer

Q8. Find the second largest prime number from a given array of positive integers. Also return it's index in most optimal way

Ans.

Find the second largest prime number and its index from an array of positive integers.

  • Iterate through the array and check if each number is prime

  • Store the largest and second largest prime numbers found so far

  • Also store their indices

  • Return the second largest prime number and its index

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. If a person travels from point A to point B at 20 km/h and returns at 30 km/h, calculate the average speed without using pen and paper.

Ans.

The average speed can be calculated by taking the harmonic mean of the two speeds.

  • To calculate the harmonic mean, divide the sum of the speeds by the reciprocal of the sum of their reciprocals.

  • In this case, the harmonic mean can be calculated as 2/(1/20 + 1/30) = 24 km/h.

Add your answer

Q10. Which data structure would i use to program a jigsaw puzzle program and what methods would i use to solve the puzzle

Ans.

The data structure to program a jigsaw puzzle program would be a graph.

  • Use a graph data structure to represent the puzzle pieces and their connections.

  • Each puzzle piece can be represented as a node in the graph.

  • Edges between nodes represent the connections between puzzle pieces.

  • To solve the puzzle, use graph traversal algorithms like depth-first search or breadth-first search.

  • Apply puzzle-solving strategies like finding corner pieces first or matching edge colors.

Add your answer

Q11. Given 8 balls of the same properties and one of these balls is defective and is heavier than the others. Calculate the minimum no. of steps to find the defective ball

Ans.

The minimum number of steps to find the defective ball is 2.

  • Divide the 8 balls into 3 groups of 3, 3, and 2 balls.

  • Compare the weights of the two groups of 3 balls.

  • If one group is heavier, divide it into 2 balls and compare their weights.

  • If the two balls have different weights, the heavier ball is the defective one.

  • If the two balls have the same weight, the remaining ball in the first group of 3 is the defective one.

Add your answer

Q12. Given an array of positive and negative integers, find the first missing positive number in the most optimal way

Ans.

Find the first missing positive number in an array of positive and negative integers.

  • Sort the array in ascending order

  • Iterate through the sorted array and find the first positive number that is missing

  • If no positive number is missing, return the next positive number after the largest positive number in the array

Add your answer
Q13. What is polymorphism in object-oriented programming?
Ans.

Polymorphism in OOP allows objects of different classes to be treated as objects of a common superclass.

  • Polymorphism allows for flexibility and reusability in code.

  • It enables a single interface to be used for different data types.

  • Examples include method overriding and method overloading.

Add your answer
Q14. What is the difference between method overloading and method overriding?
Ans.

Method overloading is having multiple methods in the same class with the same name but different parameters. Method overriding is having a method in a subclass with the same name and parameters as a method in its superclass.

  • Method overloading involves multiple methods with the same name but different parameters.

  • Method overriding involves a subclass redefining a method from its superclass with the same name and parameters.

  • Method overloading is resolved at compile time based on...read more

Add your answer

Q15. What is operator overloading?. Give an example

Ans.

Operator overloading is the ability to redefine operators for custom classes.

  • Allows operators to be used with custom classes

  • Example: '+' operator can be used to concatenate strings

  • Can improve readability and simplify code

Add your answer

Q16. Differentiate between method overloading and method overriding

Ans.

Method overloading is having multiple methods with the same name but different parameters. Method overriding is having a method in a subclass with the same name, return type, and parameters as a method in its superclass.

  • Method overloading is achieved within the same class.

  • Method overriding occurs in a subclass that inherits from a superclass.

  • Method overloading is determined at compile-time based on the number, type, and order of parameters.

  • Method overriding is determined at r...read more

Add your answer
Q17. What is a Binary Search Tree (BST)?
Ans.

A Binary Search Tree (BST) is a data structure where each node has at most two children, with the left child being less than the parent and the right child being greater.

  • Nodes in a BST are arranged in a hierarchical order where the left subtree of a node contains only nodes with keys less than the node's key, and the right subtree contains only nodes with keys greater than the node's key.

  • BST allows for efficient search, insertion, and deletion operations with a time complexit...read more

Add your answer

Q18. What is polymorphism with examples

Ans.

Polymorphism is the ability of an object to take on many forms. It allows objects of different classes to be treated as the same type.

  • Polymorphism is achieved through method overriding and method overloading.

  • Method overriding allows a subclass to provide a specific implementation of a method that is already defined in its superclass.

  • Method overloading allows multiple methods with the same name but different parameters to be defined in a class.

  • Polymorphism enables code reusabi...read more

Add your answer
Q19. What is operator overloading?
Ans.

Operator overloading is the ability to redefine the behavior of operators for user-defined data types.

  • Allows operators to be used with custom data types

  • Can define custom behavior for operators like +, -, *, etc.

  • Helps make code more readable and intuitive

  • Example: Overloading the + operator for a custom Vector class to add two vectors

Add your answer

Q20. Delete a Node in Linked list.

Ans.

To delete a node in a linked list, we need to find the node and update the pointers of its previous and next nodes.

  • Find the node to be deleted by traversing the linked list

  • Update the pointers of the previous and next nodes to skip the node to be deleted

  • Free the memory occupied by the node to be deleted

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Ambey Mining

based on 1 interviews
Interview experience
2.0
Poor
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Interview Questions from Similar Companies

3.7
 • 45 Interview Questions
4.3
 • 25 Interview Questions
3.6
 • 15 Interview Questions
3.6
 • 12 Interview Questions
3.5
 • 11 Interview Questions
3.7
 • 10 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter