Skip to main content

Iquanti Apptitude Test for ror

Iquanti Apptitude Test for ror ?

Anagrams
Max. Marks 100
Given two strings A and B, check if they are anagrams.

Two strings are said to be anagrams, if one string can be obtained by rearranging the letters of another.

Examples of anagrams are dog, god; abac, baac; 123, 312

abab, aaba; dab, baad are not anagrams.

INPUT :

First line of the input is the number of test cases T.
It is followed by T lines, each line has two space separated strings A and B;

OUTPUT For each test case, print "YES" if they are anagrams, otherwise print "NO". (without quotes)

Constraints
1 <= T <= 10
A and B both contain only lower case latin letters 'a' to 'z' and digits 0 to 9.
Length of each string A and B does not exceed 5*10^5 (500000),

Sample Input(Plaintext Link)
 3
abcd bcda
bad daa
a1b2c3 abc123
Sample Output(Plaintext Link)
 YES
NO
YES

====================
4.
Prime or Not
Max. Marks 100
Given the number N check whether it is prime number or not.

Input:
Input contains a single integer N.

Output:
Print Prime if N is prime number else print Not Prime.

Note:
A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.

Constraints:
1<=N<=100

Sample Input(Plaintext Link)
 17
Sample Output(Plaintext Link)
 Prime


 =================
 1.
Crazy Series
Max. Marks 100
Abhimanyu has one magical series:

1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, ..........
Abhimanyu got one magical function F(N) for some magical integer N, such that F(N) represents the Nth term of the magical series.

For two more magical integers L and R, Abhimanyu wants to find the integer S:

S = F(L) + F(L + 1) + ... + F(R - 1) + F(R)
Abhimanyu wants to find S % M, for M = 1000000007 (109 + 7).

Input

First line of input is an integer T, total number of test cases, followed by T lines. Each line consists of two space separated integers L and R.

Output

Output S % M in single line for each test case.

Constraints

1 <= T <= 1000000 (106)
1 <= L, R <= 50000000000 (5 x 1010)
L <= R
Note: Large input data. Use fast I/O.

Sample Input(Plaintext Link)
 5
1 3
5 10
9 18
7 17
10 10
Sample Output(Plaintext Link)
 5
22
51
53
4
Explanation
For L = 1, R = 3: F(1) = 1 F(2) = 2 F(3) = 2

So S = F(1) + F(2) + F(3) = 1 + 2 + 2 = 5



=============
2.
What is the maximum distance that you can cover?
Max. Marks 100
You have to go on a trip in your car which can hold a limited amount of fuel. You know how many liters of fuel your car uses per hour for certain speeds and you have to find out how far a certain amount of fuel will take you when travelling at the optimal speed.

You will be given a set of speeds, a corresponding set of fuel consumption and an amount that tells you the amount of fuel in your tank.

The input will be

The first line contains an integer N, that signifies the number of speeds for the car
The second line contains N number of speeds
The third line contains N number of consumption, such that if the car moves at ith speed (in km/hr) it consumes ith fuel (in ml)
The 4th line contains the fuel available in your car
You have to tell what is the maximum distance that the car can travel (in kilometers) with the given amount of fuel, and travelling at a constant speed equal to one of the elements of speeds.

Note:

You have to return a double value, with upto 3 digits after the decimal

Sample Input(Plaintext Link)
 6
250 240 230 220 210 211
5000 4500 4000 3500 3000 3000
50000
Sample Output(Plaintext Link)
 3516.666

Comments

Popular posts from this blog

Rails Migration Difference between Text and String

Rails Migration Difference between Text and String ? While working with Rails Migration Difference between Text and String is important to be known to every developer. Columns and their data types are finalized while deciding Table structure. This tutorial will help understand difference between String and Text column type and illustrate how to write Rails Migration implementing the same. You might want to read about database.yml files for specifying database configuration for Rails Application. 1. Concepts When String or Text data type is required?     Whenever you require your column to store information which is lengthy in size (Many characters), you need to consider String or Text data type for the column.     Both of them let you store Many(How Many - will see later) characters Difference between String and Text Considering MySQL database Feature     String     Text Length     1 to 255     ...

Error malloc(): memory corruption nginx with passenger?

Error malloc(): memory corruption nginx with passenger Passenger issue resolving steps :  sudo gem uninstall passenger(uninstall all passenger) sudo gem install passenger sudo passenger-install-nginx-module --auto --auto-download --prefix=/opt/nginx --extra-configure-flags=none Update nginx config file with new passenger version and restart the nginx

rake db migrate with down, up, redo, rollback options in rails

rake db migrate with down, up, redo, rollback options ? rake db migrate - This can be used to migrate your production/test database using various options like up, down, step, redo, version etc. In this tutorial we will learn how all these options can be used with rake tool to migrate the database. What is rake? rake is basically ruby make. i.e. make tool for ruby It has similar functionality to the make tool that you may have used on unix based systems for comopiling running some kind of script. rake allows you to ruby particular task in the environment that you specify. How to Install rake? You can install rake by installing gem 'rake' as, gem install rake Above command will install the latest version of rake tool avaialable. Various rake db migrate commands Operation     Command     Description General     rake db:migrate     This will migrate your database by running migrations that are not run yet Running specific Migra...