Dell Coding Questions and Answers

Sample Dell Coding Questions with Solutions

On this page, you will get Sample Dell Coding Questions and Answers asked in Online Assessment and Technical Interview involved Dell Recruitment Process.

Apart from this, you will get Faq’s on details like Job profiles, Job Locations, Salary Offered, and specific steps of the Recruitment Process of Dell.

dell-coding-questions

Sample Dell Coding Questions and Answers - Set 1

Question 1 : Reach the Channel

Problem Statement – Sahil watches TV all day and gets bored. He started playing this dumb game of identifying minimum number of inputs needed to reach a channel. As his cousin, you have to help him, but you live far from his house. So you decide to write a code that will ask Sahil for some inputs and give outputs respectively.

Here are the problems you need to keep in mind,

  • There are 13 buttons on his remote: 10 buttons for the numbers (0-9) to form integers denoting respective channel index, “Up channel” button and  “ Down channel” button for going i +1th channel and i-1th channel from i respectively, and  a “Last viewed” button to see what’s the last channel before it. 
  • The number buttons allow you to jump directly to a specific channel  (Ex: to go to channel 172 by typing 1,7,2).
  • If the channel which you are in is ith and that is the max channel index possible, by Up channel, you will reach the first channel possible. Same goes for the down channel button. You can go to the highest channel possible if you go down from the lowest channel possible.

Sahil can get from one channel to the next in one of the two ways.

Sahil’s parents have set some parental control on some channels on Aniruth’s television. The “Up Channel “ and “Down buttons” buttons skip these channels as these channels are not viewable.

Given a list of channels to view, the lowest channel, the highest channel, and a list of blocked channels, your program should return the minimum number of clicks necessary to get through all the shows that Anirudh would like to match.

Input Format

  • First line is the lowest Channel
  • Second-line is the highest Channel
  • Followed by a number of blocked channels B, 
  • and the next B lines contain the actual blocked channels.
  • Followed by the number of Channels to view V, and the next V lines contain the actual channels to view.

Constraints 

  • The lowest channel on the television will be greater than 0. and less than or equal to 10,000.
  • The highest channel on the television will be greater than or equal to the lowest channel. and less than or equal to 10.000. 
  • The list of channels that are blocked on Anirudh’s television. All the channels in this list will be valid channels (greater than or equal to lowest channel, less than or equal 1 to highest channel). Duplicates may be Ignored. The blocked list can be a maximum of 40 channels.  
  • The sequence that Sahil must view contains between 1 and 50 elements. inclusive. All channels in this sequence are not in the blocked list and are between lowest channel and highest channel. Inclusive.

Sample Input 0:

1

20

2

18

19

5

15

14

17

1

17

Sample output 0:

7

Prime Course Trailer

Related Banners

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

Question 2 : Total Distance Covered by the Beetle

Problem Description

A 10cm x 10cm x 10cm solid cube rests on the ground. It has a beetle on it, as well as some sweet honey spots on the cube’s surface. The beetle begins at a point on the cube’s surface and moves in a clockwise direction along the cube’s surface to the honey spots.

  • If it goes from one point on the same face to another (say, X to Y), it goes in an arc of a circle that subtends an angle of 60 degrees at the circle’s center.
  • If it travels from one point to another on a different face, it takes the shortest path on the cube’s surface, except that it never travels along its bottom.

The beetle is a Cartesian geometry student who knows the coordinates (x, y, z) of all the points it needs to visit. Its coordinate origin is one of the cube’s corners on the ground, and the z-axis points up. As a result, z=0 is the bottom surface (on which it does not crawl), and z=10 is the top. The beetle keeps track of all distances traveled and rounded the distance to two decimal places when it arrives at the following location so that the final distance is a sum of the rounded distances from spot to spot.

Input

The first line returns an integer N, the total number of points visited by the beetle (including the starting point).

The second line contains 3N non-negative numbers, each with two decimal places. These are to be interpreted as the x, y, and z coordinates of the points the beetle must visit in the given order.

Output

One line containing a number representing the total distance traveled by the beetle to two decimal places. Even if the travel distance is an integer, the output should have two decimal places.

Constraints

None of the points visited by the beetle are on the bottom face (z=0) or on any of the cube’s edges (the lines where two faces meet)

2<=N<=10

Question 3: Find the homeless 

Problem Statement -:  There are N Homeless people in the community and N houses in the community. It will be given in the array (people) , height of the person and in the array house capacity of the house is given.

Government decided to give homes for people on the basis of following conditions:

  • Priority is given for the people from left to right of the array
  • Each person is allotted to a house if and only if the capacity of house is greater than or equal to persons height
  • Nearby empty Houses are alloted to the person( starting from extreme left)

You need to find the number of homeless people who have not allotted any home if the government follows the above conditions.So that government will have an idea for how many people they need to allot home for next time.

Constraints:

  • 1 <= N <= 10^3
  • 1 <= people[i] <= 10^5
  • 1 <= house[i] <= 10^5

Input Format for Custom Testing:

  • The first line contains an integer, N, denoting the number of  people and number of houses.
  • Each line i of the N subsequent lines (where 0 <= i <= N) contains an integer describing peoplei.
  • Each line i of the N subsequent lines (where 0 <= i <= N) contains an integer describing housei.

Sample Test Cases

  • Sample Input 1
    3  
    4
    2
    7
    3
    5
    10
  • Sample Output 1
    0
  • Explanation
    people=[4,2,7]
    house=[3,5,10]
    People[0] has more priority , from left to right order in houses 5 is the nearest one which fits for people[0]
    people[1]=2 will fit in 3 which is nearer from left
    people[2]=7 will fit in remaining house of capacity of 10
    So no homeless people left so return 0 
  • Sample Input 2
    3
    3
    8
    5
    1
    9
    4
  • Sample Output 2
    2
  • Explanation
    people=[3,8,5]
    house=[1,9,4]
    people[0]=3 can fit in 9 which is nearest from left in array house
    people[1]=8  cannot fit in any home which is left (i.e, 1 and 4)
    people[2]=5 cannot fit in any home which is left (i.e, 1 and 4)
    So return 2,which is number of homeless people

Question 4: Game Of Clicks

Problem Statement  :

Sahil watches TV all day and gets bored. He started playing this dumb game of identifying minimum number of inputs needed to reach a channel. As his cousin, you have to help him, but you live far from his house. So you decide to write a code that will ask Sahil for some inputs and give outputs respectively.

Here are the problems you need to keep in mind :

  • There are 13 buttons on his remote: 10 buttons for the numbers (0-9) to form integers denoting respective channel index, “Up channel” button and “ Down channel” button for going i +1th channel and i-1th channel from i respectively, and a “Last viewed” button to see what’s the last channel before it.
  • The number buttons allow you to jump directly to a specific channel (Ex: to go to channel 172 by typing 1,7,2).
  • If the channel which you are in is ith and that is the max channel index possible, by Up channel, you will reach the first channel possible. Same goes for the down channel button. You can go to the highest channel possible if you go down from the lowest channel possible.
  • Sahil can get from one channel to the next in one of the two ways.
  • Sahil’s parents have set some parental control on some channels on Aniruth’s television. The “Up Channel “ and “Down buttons” buttons skip these channels as these channels are not viewable.
  • Given a list of channels to view, the lowest channel, the highest channel, and a list of blocked channels, your program should return the minimum number of clicks necessary to get through all the shows that Anirudh would like to match.

Input Format :

  • First line is the lowest Channel
  • Second-line is the highest Channel
  • Followed by a number of blocked channels B,
    and the next B lines contain the actual blocked channels.
  • Followed by the number of Channels to view V, and the next V lines contain the actual channels to view.

Constraints :

  • The lowest channel on the television will be greater than 0. and less than or equal to 10,000.
  • The highest channel on the television will be greater than or equal to the lowest channel. and less than or equal to 10.000.
  • The list of channels that are blocked on Anirudh’s television. All the channels in this list will be valid channels (greater than or equal to lowest channel, less than or equal 1 to highest channel). Duplicates may be Ignored. The blocked list can be a maximum of 40 channels.
  • The sequence that Sahil must view contains between 1 and 50 elements. inclusive. All channels in this sequence are not in the blocked list and are between lowest channel and highest channel. Inclusive.

Sample Input 0:
1
20
2
18
19
5
15
14
17
1T
17
Sample output 0:
7

Question 5

Fountains are installed at every position along a one-dimensional garden of length n. Array locations[] represents the coverage limit of these fountains. The ith fountain (where 1sisn) has a coverage limit of locations[i] that can range from the position max((i – locations[i]), 1) to min((i + locations[i]), n ). In other words, the h fountains do not reach outside the boundaries of the garden. In the beginning,all the fountains are switched off. Determine the minimum number of fountains that need to be activated to cover the n length garden by water.

Example

  • n = 3
  • locations[] = {0, 2, 13, then
    • For position 1: locations[1] = 0, max((1 – 0),
      • 1) to mini (1+0), 3) gives range = 1 to 1
    • For position 2: locations[2] = 2, max((2-2),
      • 1) to min( (2+2), 3) gives range = 1 to 3
    • For position 3: locations[3] = 1, max( (3-1),
      • 1) to min( (3+1), 3) gives range = 2 to 3

For the entire length of this garden to be covered, only the fountain at position 2 needs to be activated.

Function Description

Complete the function fountainActivation in the editor below.

fountainActivation has the following Parameter:

  • int locations[n]: the fountain locations

Returns

  • int: the minimum number of fountains that must be activated

Constraints

  • 1<_n<_ 10^5
  •  O<_locations[i] <_ mini (n,100) (where 1 <_1<_10^5)

► Input Format For Custom Testing

Sample Case 0

Sample Input For Custom Testing

  • 3 ->locations[] size n = 3
  • 1 ->locations[] [1, 1, 1
  • 1 ->Sample Output

Sample Output

  • 1

Explanation

Here, locations = {1, 1, 13

  • For position 1: locations[1] = 1, maxi (1 -1), 1) to min((1+1), 3) gives range = 1 to 2
  • For position 2: locations[2] = 1, max( (2 -1), 1) to min( (2+1), 3) gives range = 1 to 3
  • For position 3: locations[3] = 1, max((3 -1), 1) to min((3+1), 3) gyes range = 2 to 3

If the 2nd fountain is active, the range from position 7 to 3 will be covered. The total number of fountains needed is 1.

Sample Dell Coding Questions and Answers - Set 2

Question 1: Spiral Matrix

Problem Statement :

You will be given a 2d matrix. Write the code to traverse the matrix in a spiral format. Check the input and output for better understanding.

Sample Input :
Input :
5 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20

Output :

1 2 3  4 5 6 7 8 9 10 11 12 13 14  15 16 17 18 19 20

Question 2: Share Holder (R -> Hard)

Problem statement :

Ratan is a crazy rich person. And he is blessed with luck, so he always made the best profit possible with the shares he bought. That means he bought a share at a low price and sold it at a high price to maximize his profit. Now you are an income tax officer and you need to calculate the profit he made with the given values of stock prices each day. You have to calculate only the maximum profit Ratan earned.
Note that:
Ratan never goes into loss.

Example 1 :

Price=[1,6,2]
Ratan buys it on the first day and sells it on the second.

Example 2 :

Price=[9,8,6]

The Price always went down, Ratan never bought it.

Input Format:
First line with an integer n, denoting the number days with the value of the stack
Next n days, telling the price of the stock on that very day.

Output Format:
Maximum profit done by Ratan in a single line.
Constraints:
Number of days <=10^8

Sample Input for Custom Testing

STDIN
———–
7
1
9
2
11
1
9
2

Sample Output

10

Explanation

The maximum profit possible is when Ratan buys it in 1 rupees and sells it in 11.

Question 3: Total Distinct Money

Problem Statement  :

You woke up from sleep and found yourself in the 0th row and 0th column of a grid. every other square in a grid has some amount of money kept there. If you are given the matrix with all the values left in the cells, you have to find how many different ways are there to rich the r-1 th , c-1 th cell and the sum of all possible amount of money you will have each time if you bring all the money kept in places in the cell.

Note that, if you are in i,j th cell, either you can go i+1, j th cell or you can go i,j+1 cell. 

Again, the 0,0th grid and the n-1,m-1 th grid will have 0 value.

Input Format:

Two integers R and C meaning the number of rows and columns.

Next R lines C space separated integers denoting the total grid.

Output Format:

First Line denoting the distinct ways to rich.

Next line denotes the total money if you use all possible distinct ways (Given that if you take the money from a cell, the money is readded in the cell).

Sample Input:

3 3

0 2 3

1 3 2

1 1 0

Sample Output:

4

21

Explanation:

The all possible totals are:

0 -> 2 -> 3 -> 2 -> 0  Total = 7

0 -> 2 -> 3 -> 2 -> 0  Total = 7

0 -> 2 -> 3 -> 1 -> 0  Total = 6

0 -> 1 -> 3 -> 2 -> 0  Total = 6

0 -> 1 -> 3 -> 1 -> 0  Total = 5

0 -> 1 -> 1 -> 1 -> 0  Total = 3

There are 4 distinct ways and the total is 21

Question 4: Help Anirudh

Problem Statement  :
Anirudh loves to play games but his father is very strict. But one day his father agreed to get him a new game if he solves the following problem –
Given an array of Integers, determine the number of moves to make all elements equal. Each move consists of choosing all but 1 element and Incrementing their values by 1. Can you help Anirudh?

Example :
numbers= [3, 4, 6, 6, 3]
Choose 4 of the 5 elements during each move and Increment each of their values by one. Indexing begins at 1. It takes 7 moves as follows:

iterationarray
0[3,4,6,6,3]
1[4,5,7,6,4]
2[5,6,7,7,5]
3[6,7,8,7,6]
4[7,8,8,8,7]
5[8,9,9,8,8]
6[9,9,10,9,9]
7[10,10,10,10,10]

Returns: long: the minimum number of moves required

Constraints
1<=n<=10^5
1<=numbers(i)<=10^6

Sample case 0:
Sample input 0:
5 → size of numbers[]
3 → numbers[]=[3,4,6,6,3]
4
6
6
3
Sample output 0:
7

Sample input 1:
4
4
3
4

Sample Output 1:
2

Question 5: Match Substring After Replacement

Given two strings, s, and sub, along with a 2D character array mappings, we want to determine if it is possible to make the sub a substring of s by replacing characters according to the provided mappings. Each mapping consists of a pair [oldi, newi], indicating that we can replace the character oldi in sub with newi.
The replacement can be performed any number of times, but each character in sub can be replaced at most once.
We need to return true if it is possible to create sub as a substring of s using the given replacements, and false otherwise.

Example 1:

Input:
s = “fool3e7bar”
sub = “leet”
mappings = [[“e”,”3″],[“t”,”7″],[“t”,”8″]]
Output: True

Explanation:
We replace the first occurrence of ‘e’ in sub with ‘3’ and ‘t’ in sub with ‘7’, resulting in sub becoming “l3e7”. Now, “l3e7” is a substring of s, so we return true.

Example 2:
Input:
s = “fooleetbar”

sub = “f00l”
mappings = [[“o”,”0″]]
Output: False

Explanation:
The string “f00l” is not a substring of s, and no replacements can be made to create it. Additionally, we cannot replace ‘0’ with ‘o’, so it is not possible to create sub from s. Hence, we return false.

Example 3:
Input:
s = “Fool33tbaR”
sub = “leetd”
mappings = [[“e”,”3″],[“t”,”7″],[“t”,”8″],[“d”,”b”],[“p”,”b”]]
Output: True

Explanation:
We replace the first and second occurrences of ‘e’ in sub with ‘3’ and ‘d’ in sub with ‘b’, respectively. This transforms sub into “l33tb”, which is a substring of s. Therefore, we return true.

Constraints:
1 <= sub.length <= s.length <= 5000

0 <= mappings.length <= 1000
mappings[i].length == 2
oldi != newi
Both s and sub consist of uppercase and lowercase English letters and digits.
oldi and newi are either uppercase or lowercase English letters or digits.

FAQs on Dell Coding Questions

Question 1: What is the eligibility criteria in Dell Recruitment Process for freshers ?

In Dell recruitment process following eligibility criteria has to be followed for SDE Role Hiring:

  1. Candidate must have a minimum 70% aggregate in B.Tech/ BE/ BCA or last year appearing candidate.
  2. At least 60% aggregate in 10th and 12th.
  3. No backlogs at the time of application.
Question 2: Is coding questions asked in Dell Recruitment Process?

Yes, in both 1st Round (i.e Online Assessment) and 2nd Round (i.e. Technical Interview) coding questions were asked in Dell Recruitment Process.

Question 3: What is the procedure of Dell Recruitment Process ?

Dell Recruitment Process for Hiring Freshers includes following steps:

  1. Resume Shortlisting
  2. Online Aptitude + Coding Assessment
  3. Technical Interview
  4. HR Interview
Question 4: What are the topics included in Technical Interview of Dell ?

In technical Interview OOPS concepts, Data structure, algorithms, DBMS, OS, computer networks, CPU scheduling, C++, Java, and other programming languages, etc. based questions are included.

Question 5: What is the salary offered by Dell for SDE Roles for freshers ?

For SDE Roles ₹ 8 – 12 LPA is offered by Dell for Freshers.

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