Add office photos
Employer?
Claim Account for FREE

Nvidia

3.8
based on 510 Reviews
Filter interviews by

The Hershey Company Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations
Q1. Order of People Heights

There are ‘N’ people numbered from 0 to N - 1, standing in a queue. You are given two arrays ‘Height’ and ‘Infront‘ consisting of ‘N’ non-negative integers. ‘Height[i]’ gives the height o...read more

Ans.

The task is to find the actual order of people in a queue based on their heights and the number of taller people in front of them.

  • Iterate through the given arrays and create a list of tuples containing the height and number of taller people for each person.

  • Sort the list of tuples in descending order of height and ascending order of the number of taller people.

  • Create an empty result list and insert each tuple into the result list at the index specified by the number of taller ...read more

View 3 more answers
Q2. Find a value in BST

You have been given a Binary Search Tree and a key value ‘X’, find if a node with value ‘X’ is present in the BST or not.

Note:
You may assume that duplicates do not exist in the tree. 
For e...read more
Ans.

The task is to find if a given value is present in a Binary Search Tree (BST).

  • Start from the root node and compare the value with the target value.

  • If the value matches, return true.

  • If the target value is less than the current node value, move to the left child.

  • If the target value is greater than the current node value, move to the right child.

  • Repeat the process until a match is found or a leaf node is reached.

  • If a leaf node is reached and no match is found, return false.

View 2 more answers
Q3. C Question

What is the use of a function pointer in C?

View 2 more answers
Q4. CS Fundamentals Question

What is Little and Big Endian?

Add your answer
Discover The Hershey Company interview dos and don'ts from real experiences
Q5. Operating System Question

What does a kernel do?

Add your answer
Q6. OOPS Question

What is a storage class?

Add your answer
Q7. CS Fundamentals Question

Program to determine if your system is little or big endian

Add your answer
Q8. OOPS Question

What is a volatile keyword?

Add your answer
Q9. Data Structure Question

Design data structure to implement multi threading.

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 Software Developer Interview Questions from Similar Companies

3.9
 • 40 Interview Questions
4.1
 • 29 Interview Questions
3.5
 • 24 Interview Questions
3.6
 • 21 Interview Questions
4.8
 • 15 Interview Questions
4.3
 • 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
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

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