A class octopus has a dummy head which has four pointers – left, right, top and bottom. You have to build link list in these 4 directions depending on the input commands. There will be four types of commands – L, R, T and B. Their specifications are given below:
L x: insert x in the left link list // Where x is an integer number.
R x: insert x in the right link list
T x: insert x in the top link list
B x: insert x in the bottom link list
Input: Test case will start with a number n indicating the number of lines following it.
Output: you have to give output that which link list (Left, Right, Top and Bottom) has maximum sum of values. See the sample input and output.
Sample input
14
L 3
L 15
L 1
R 17
T 9
T 10
B 13
T 5
L 8
R 3
R 12
B 2
B 3
B 4
Sample output
Right Link List Has Maximum Sum 32
write a program to initialize the value as 5.800000 & display the value on the monitor?
Victor has an array of size n. He loves to play with these n numbers. Each time he plays
with them, he picks up any two consecutive numbers and adds them. On adding both the
numbers, it costs him k*(sum of both numbers).
Find the minimum cost of adding all the numbers in the array.
Input Specification:
input1: Size of array.
input2: Elements of the array.
input3: Value of k.
Output Specification:
Return the minimum cost of adding all the numbers of the array.
Suppose a company “ABC” is conducting a test to hire you as OOP Developer and asked you develop a calculator for the basic Arithmetic operators (+, -, *, /, %), where you have to deal at least 11 digit numbers. The numbers can be of with decimal point or without decimal point. The company wants you to develop an efficient code. You can choose any of the following options to develop this whole scenario:
You have to answer, which option will you choose and arguments in favour of your chosen option regarding code efficiency, code complexity and other factors.
Given an unsorted dynamic array (arr) and two numbers x and y, find the minimum distance between x and y in the array (arr) using functions. The array might also contain duplicates. You may assume that both x and y are different and present in the array (arr). You are also advised to NOT use the INT_MAX and abs() function.
Sample Input & Output
Input: arr[ ] = {3, 5, 4, 2, 6, 5, 6, 6, 5, 4, 8, 3}, x = 3, y = 6
Output: Minimum distance between 3 and 6 is 4
(3 to 5 => 1 unit, 5 to 4 => 1 unit, 4 to 2 => 1unit & 2 to 6 => 1 unit
So, Total Minimum Distance = 1+1+1+1 = 4)
write a C program to count the number of zero elements in a two dimensional matrix using function with 2D array as an argument
Sample input:
12 0 38
4 3 0
7 0 9
No of zero elements:3