Month: July 2017

Restaurant – Lucky Numbers Discount

       Restaurant - Lucky Numbers Discount Every day in a restaurant two numbers X and Y are considered lucky numbers.If the bill amount B is divisible by X, then X% discount is offered.If the bill amount B is divisible by Y, then Y% discount is offered.If the bill amount B is divisible by

Football Player – Total Dribble Paths

         Football Player – Total Dribble Paths  A football coach wants his team to improve their dribbling skills. So he sets up a R * C grid, where R is the number of rows and C is the number of columns. From any given cell, a player can only dribble to the

Multi Layered Diamond Shaped Rhombus Pattern

Multi Layered Diamond Shaped Rhombus Pattern Given an odd value of N, the program must print multi layered rhombus pattern in diamond shapes whose side contains N, N-2, … 1 slashes respectively as shown below in the examples. Input Format:The first line contains N. Output Format:The  multi layered rhombus pattern in diamond shapes whose side

Traverse Square Matrix – Spiral Clockwise

Traverse Square Matrix - Spiral Clockwise  A square matrix of size N*N is provided. The program must traverse the matrix spirally and print the elements in a single line. Input Format:The first line contains N.Next N lines, contain N column values C(i,j) each separated by a space. Output Format:The first line contains N*N values separated

2D Matrix Absolute Difference Diagonals Elements Sum

2D Matrix Absolute Difference Diagonals Elements Sum A Square Matrix has N rows and N columns. Get the matrix as input and find the absolute difference between the sum of the values in the two diagonals. Input Format: The first line contains N.Next N lines containing the elements of the matrix with N column values

Word Slot

                             Word Slot                                 A Square Matrix of N Rows and N Columns is passed as the input and also a String S of Length L is

Reverse the words in the given String

Reverse the words in the given String Given a string S as the input Write a program to print the reverse order of the words in the string S.Input Format:The first line contains S.Output Format:The first line contains the words in the reverse order.Boundary Conditions:1 <= Length of S <= 100Example Input/Output 1:Input:I Love IndiaOutput:India

Array Element Adjacent Sum

                Array Element Adjacent Sum Given an Array of length N, the program must print the sum of adjacent numbers of elements present in the array. Input Format:First line contains N.Second line contains N element values seperated by a space. Output Format:Adjacent sum of N elements seperated by a

Left Greater Number

                 Left Greater Number Given an array of N positive integers, for each number print the first number to it’s left which is greater than the current number. Print -1 if there is no greater number on it's left.Input Format:The first line contains N.The second line contains N

2D Matrix – Elements Adjacent Sum

                 2D Matrix – Elements Adjacent Sum                                                         Given a matrix of R rows and C columns, for each element print