HP Coding Questions and Answers

HP Coding Questions with Solutions

This page will help you to get HP Enterprise Coding Questions and Answers asked in the Recruitment Process of the company. Other than that you will find Insights on Online Assessments, Steps involved in the Recruitment Process, Eligibility Criteria, CTC Offered, Interview Rounds, and Job Profiles offered. 

HP Enterprise offers various roles for freshers, to get more specific details please go through this page.

junglee-games-coding-questions-and-answers-pdf

About HP Enterprise

HP Enterprise (Hewlett Packard Enterprise) is a global technology company that provides a wide range of products, solutions, and services for businesses and organizations. It was formed in 2015 as a result of the split of the Hewlett-Packard Company into two separate entities, with HP Enterprise focusing on enterprise-level products and services.

HP Enterprise serves a wide range of industries, including healthcare, finance, government, telecommunications, manufacturing, and more. The company focuses on delivering innovative solutions that help organizations transform their businesses, increase agility, and drive growth.

About HP Enterprise Recruitment Process

This Recruitment process consists of the following steps :

  1. Online Assessment [Aptitude, Verbal and Technical Based ]
  2. Technical Interview
  3. HR Interview

We have mentioned further details of the HP Enterprise Recruitment Process in the following Tabular Form

HP Enterprise Related Information
Position :
  • Software Engineer
  • Software Developer
Course :
  • B.Tech / M.Tech
  • Eligible Batch – 2023
Eligibility Criteria / Academic Qualification Required :
  • Minimum 60% or equivalent CGPA of 6 and above in 10th and 12th
  • Minimum 6.5 CGPA in Graduation / Post Graduation.
  • No Backlogs
Cost to Company (CTC)
  • Software Engineer Role : 8 – 10 LPA
  • Software Developer Role : 9 – 12 LPA
Selection Process :
  1. Online Assessment
  2. Technical Interview
  3. HR Interview

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Sample HP Enterprise Coding Questions With Solutions

Question 1: Detecting loop in a linked list

Problem Statement –  You are given a singly linked list, where each node contains a value and a pointer to the next node in the list. Your task is to determine if the linked list contains a cycle or not.

A cycle in a linked list occurs when there is a node in the list whose next pointer points to a previously visited node, creating a loop.

You need to implement an efficient solution with a time complexity of O(n) and a space complexity of O(1), where n is the number of nodes in the linked list.

Function Description:

Complete the hasLoop function that takes the head of the linked list as input and returns true if a cycle exists, and false otherwise.

Constraints:

  • The number of the nodes in the list is in the range [1, 99].
  • -105 <= Node.val <= 105

Sample Cases

Sample Input :

list = [1, 2, 3, 4]

loop at 4 -> 1

Sample Output :
Loop Detected

Question 2: Stepping Numbers

Problem Description :

Stepping Numbers are numbers in which the adjacent digits differ by 1. For example, 123, 545, and 98 are stepping numbers, while 321, 444, and 75 are not. The task is to find all stepping numbers in a given range [n, m].

  • For example
    • Range: [100, 500]
    • Stepping Numbers: 101, 121, 123, 210, 212, 232, 234, 321, 323, 343, 345
    • Explanation: The stepping numbers between 100 and 500 are 101, 121, 123, 210, 212, 232, 234, 321, 323, 343, and 345. These numbers have adjacent digits that differ by 1.

Write code to find out all the stepping numbers in the given range.

Input Format: First line contains two numbers N,M

Output Format: Print all the stepping numbers present in the range.

Constraints: 0 <= N < M <= 1,000,000,000

Question 3: Remove all characters in a given string that are not lowercase or numerical

The task is to remove all characters in a given string that are not lowercase letters or numerical digits. The purpose is to clean the string and only keep the lowercase letters (a-z) and numerical digits (0-9), discarding any other characters such as whitespace, punctuation marks, or uppercase letters.

  • For example
    • Input: “Hello!123$”
    • Output: “ello123”
    • Explanation: The input string contains uppercase letters, an exclamation mark, and a dollar sign. After removing all characters that are not lowercase or numerical, only the lowercase letters “e”, “l”, “l”, “o”, and the numerical digits “1”, “2”, “3” remain.

Write the code to remove all characters in a given string that are not lowercase or numerical.

Input Format: First line contains two numbers N,M

Output Format: Print all the stepping numbers present in the range.

Constraints: 0 <= N < M <= 1,000,000,000

Question 4: Minimum steps needed to cover a sequence of points on an infinite grid

The task is to determine the minimum number of steps required to cover a sequence of points on an infinite grid. The infinite grid extends indefinitely in all directions, and each point in the sequence represents a coordinate on the grid.

  • For example
    • Input: points[] = [(1, 1), (2, 2), (2, 3)]
    • Output: 2
    • Explanation:
      From (1, 1) to (2, 2):The x-coordinate increases by 1, and the y-coordinate increases by 1.
      Therefore, we need to take 1 step diagonally to reach the next point.
      Total steps required: 1 step.From (2, 2) to (2, 3):The x-coordinate remains the same, and the y-coordinate increases by 1.
      Therefore, we need to take 1 step vertically to reach the next point.
      Total steps required: 1 step.The total steps required to cover the sequence of points [(1, 1), (2, 2), (2, 3)] on the infinite grid, considering all eight directions of movement, is 1 + 1 = 2 steps.

Input Format: Given sequence of cell positions.

Output Format: Print minimum no. of steps needed to cover a sequence of points.

Question 5 : Sort array after converting elements to their squares

Problem Description :

You are given an array of integers in non-decreasing order. Your task is to sort the array after converting each element to its square.

Write a function ‘sortArrayAfterSquaring’ that takes an array of integers as input and returns the sorted array after converting each element to its square.

  • For example
    • Input: [1, 2, 3, 4, 5]
    • Output: [1, 4, 9, 16, 25]
    • Explanation:
      In this example, the input array is [1, 2, 3, 4, 5]. After squaring each element, we get [1, 4, 9, 16, 25]. The resulting array is then sorted in ascending order, which gives [1, 4, 9, 16, 25]. Finally, the sorted array is printed.

Input Format: Given an sorted array containing positive and negative numbers.

Output Format: Print the sorted array containing the squares of the numbers.

FAQs on HP Enterprise Coding Questions

Question 1: What are the roles does HP Enterprise is offering for freshers?

Software Development Engineer, Project Engineer Intern, Game Content Writer, UI / UX Designer and other SDE Role for Specific Languages like C / C++, Golang, etc

Question 2: What should I expect during the interview process?
During the interview process at HP Enterprise, you can expect to be asked a series of questions related to your experience, skills, and qualifications which are needed for the role you are applying for. You will be showcasing your skills like:
  1. Programming languages, including C++, Java, and C
  2. Experience in building libraries and APIs.
  3. Knowledge of the latest gaming trends.
  4. Strong Arts, Designing, and technical skills.
Question 3: Does HP Enterprise offers any training or development programs for new hires?
Yes, HP Enterprise offers a variety of training and development programs for new hires, including Orientation related to the Industry, domain-specific training, and leadership development programs. They mainly focus on guiding the new hires to Upskill themselves and enhance their career goal in the their respective field.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription