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

Create dynamic sitemap on ruby on rails

Sitemaps are an easy way for webmasters to inform search engines about pages on their sites that are available for crawling. In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site. It’s basically a XML file describing all URLs in your page: The following example shows a Sitemap that contains just one URL and uses all optional tags. The optional tags are in italics. <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">    <url>       <loc>http://www.example.com/</loc>       <lastmod>2005-01-01</lastmod>       <changefreq>monthly</changefreq>     ...

Omniauth Linked in Ruby On Rails

def get_linkedin_user_data      omniauth = request.env["omniauth.auth"]      dat=omniauth.extra.raw_info      linked_app_key = "xxxxxxx"      linkedin_secret_key = "yyyyyyy"      client = LinkedIn::Client.new(linked_app_key,linkedin_secret_key)      client.authorize_from_access(omniauth['credentials']['token'],omniauth['credentials']['secret'])      connections=client.connections(:fields => ["id", "first-name", "last-name","picture-url"])      uid=omniauth['uid']      token=omniauth["credentials"]["token"]      secret=omniauth["credentials"]["secret"]   #linked user data     omniauth = request.env["omniauth.auth"]      data             = omniauth.info      user_name...

Install Rvm on ubuntu

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev curl -L https://get.rvm.io | bash -s stable source ~/.rvm/scripts/rvm rvm install 2.0.0-p645 rvm use 2.0.0-p645 --default ruby -v rvm gemset create rails3.2.8 rvm gemset use rails3.2.8 gem install rails -v 3.2.8