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

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

Lazy loading in rails – Rails Feature

 Lazy loading in rails – Rails Feature ? Lazy loading in rails is the amazing feature provided with rails. In console you might have tried to examine how lazy loading in rails actually works. In this tutorial, we will learn about this Rails - Lazy loading feature with examples. What exactly is Lazy Loading? As the name suggests the data is loaded in lazy manner (Really!) i.e. Your database is queried only when data from the database is required for some kind of manipulation in code. You will get more of this after you read how-to of lazy loading below. How lazy loading works: Whenever you try to get some data from database, For example, users is the database table that you have. And you are querying database to get users having age less than 20. Then, you will write code like, result = User.where("age < 20") when above statement is executed, your database is not queries yet(because the resultant data is not required yet). When you execute following code, records = resu...

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     ...