Month: May 2017

Choose Items For Highest Discount

                                                 Choose Items For Highest Discount                                                       

Odd Length String Diagonal Pattern [ZOHO]

               Odd Length String Diagonal Pattern [ZOHO] An odd length string S of length L is passed as the input.The program must print the string S as two diagonals as shown in the example  Input/Output below. Input Format:The first line will contain S. Output Format: L lines will contain

Message Encryption

                                                     Message Encryption                                   To encrypt messages Jil will first decide on the number of

Tower Line of Sight

                                             Tower Line of Sight IssueFour towers A, B, C, D are to be erected.Tower A is to communicate with tower C.Tower B is to communicate with tower D. Line of sight issue can

Pattern Printing – Floyd Triangle

          Pattern Printing - Floyd Triangle     A number N indicating the number of rows in Floyd's triangle is passed as the input.The program must print the Floyd's triangle pattern. Input Format:The first line will contain N. Output Format: The first N lines will contain the Floyd's triangle pattern. Boundary

Minimum Distance Between Words [AMAZON]

        Minimum Distance Between Words [AMAZON] A string S is passed as the input. Two words W1 and W2 which are present in the string S are also passed as the input. The program must find the minimum distance D between W1 and W2 in S (in forward or reverse order) and print

Non-Repeating Number Position

             Non-Repeating Number Position 2N+1 numbers are passed as input to the program.Out of these numbers, N numbers repeat twice and hence account for 2N numbers. Only one number I is a non-repeating number. The program must print the position of the non-repeating number (The position starts from 1). Note:

Count the 1s in the binary representation

         Count the 1s in the binary representation A positive integer N is passed as the input.The program must print the number of 1s in the binary representation of N. Input Format:First line contains N. Output Format:First line contains the count of 1s in the binary representation of N. Boundary Conditions: 1

Alternate letters in uppercase

             Alternate letters in uppercase A str‌ing (only alphabets) is passed as input.The printed output should contain alphabets in odd positions in each word in uppercase and alphabets in even positions in a word in lowercase. Example input and output: If the input is 'tREE GiVES us fruiTS', the output

Find Locker Status

Find Locker Status There are "N" closed lockers numbered 1 to N. A person begins by opening all "N" lockers. Next, he closes every second locker. Then he goes to every third locker and closes it if it is open or opens it if it is closed (toggles the locker open/close status). He continues to toggle