Add office photos
Employer?
Claim Account for FREE

Adobe

3.9
based on 1.1k Reviews
Video summary
Filter interviews by

Sanghi Jewellers Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. Maximum Sum Problem Statement

You are given an array ARR of N integers. Your task is to perform operations on this array until it becomes empty, and maximize the sum of selected elements. In each operation, sel...read more

Ans.

The task is to maximize the sum of selected elements from an array by following specific rules.

  • Select elements strategically to maximize the sum

  • Remove occurrences of selected element, and its neighbors

  • Repeat the process until the array becomes empty

Add your answer

Q2. Rearrange The Array Problem Statement

You are given an array/list 'NUM' of integers. Rearrange the elements of 'NUM' such that no two adjacent elements are the same in the rearranged array.

Example:

Input:
NUM[...read more
Ans.

The task is to rearrange an array such that no two adjacent elements are the same.

  • Iterate through the array and check if any adjacent elements are the same.

  • If adjacent elements are the same, swap one of them with a different element.

  • Return 'YES' if a valid rearrangement is possible, 'NO' otherwise.

Add your answer

Q3. Ways to Reach Nth Stair

Given the number of stairs, initially at the 0th stair, you need to reach the Nth stair. Each time, you can either climb one step or two steps. Determine the number of distinct ways to c...read more

Ans.

Calculate the number of distinct ways to climb N stairs by either taking one or two steps at a time.

  • Use dynamic programming to keep track of the number of ways to reach each stair

  • The number of ways to reach a stair is the sum of the number of ways to reach the previous two stairs

  • Return the result modulo 10^9+7

Add your answer

Q4. Level Order Traversal of Binary Tree

Given a binary tree of integers, return its level order traversal.

Input:

The first line contains an integer 'T' which represents the number of test cases. For each test cas...read more
Ans.

Level Order Traversal of Binary Tree returns nodes in level order traversal.

  • Perform a level order traversal of the binary tree starting from the root node.

  • Visit nodes level by level, printing them in the order they are encountered.

  • Use a queue data structure to keep track of nodes at each level.

Add your answer
Discover Sanghi Jewellers interview dos and don'ts from real experiences

Q5. Top View of Binary Tree Problem Statement

Given a binary tree, your task is to print the Top View of the Binary Tree. The Top View is the set of nodes visible when the tree is viewed from the top. Please ensure...read more

Ans.

The task is to print the Top View of a Binary Tree, which is the set of nodes visible when viewed from the top, in left to right order.

  • Traverse the binary tree in level order and maintain a map to store the horizontal distance of each node from the root.

  • For each node, if the horizontal distance is not already in the map, add the node's value to the result.

  • Print the values from the map in ascending order of horizontal distance to get the Top View of the Binary Tree.

Add your answer

Q6. 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
Ans.

The task is to print the left view of a binary tree given in level order form.

  • Traverse the tree level by level and print the first node of each level (leftmost node).

  • Use a queue to keep track of nodes at each level.

  • Consider null nodes as well while traversing the tree.

Add your answer
Q7. Design a system that can store an incoming stream of characters in a sorted manner and answer queries regarding whether a specific character is present or not.
Ans.

Design a system to store incoming characters in sorted manner and answer queries about character presence.

  • Use a data structure like a balanced binary search tree to store characters in sorted order.

  • Implement functions to insert characters into the tree and check for character presence.

  • Optimize search queries by using binary search or tree traversal techniques.

  • Consider edge cases like duplicate characters and handling special characters.

  • Example: Insert 'a', 'c', 'b' -> Tree: [...read more

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Mts1 Interview Questions from Similar Companies

3.8
 • 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