Ranking of "Rank"

If all words formed using only letters of the word "RANK" exactly once are arranged alphabetically. Find the position of the word RANK.


The answer is 20.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

5 solutions

Saurabh Saurabh
Aug 18, 2015

soln soln

Shouldn't it be 60? I get it that you just counted the 4 words. But if I were to follow the question "If all words formed using the letters of RANK....", then there must be 1 letter words, 2 letter words and 3 letter words. And alphabetically they should be on the upper side. So first counting 1 letter words there are 4, similarly 2 and 3 letter words are 12 and 24 respectively. Then comes 4 letter words. So answer should be 60. Did I do make any mistakes?

Imrul Khan - 5 years, 9 months ago

Log in to reply

@Imrul Khan You're absolutely right, ubt the problem has been rephrased now :)

Nice observation man.

Mehul Arora - 5 years, 9 months ago

Log in to reply

Ah, don't mention it. It was a cool one you uploaded

Imrul Khan - 5 years, 9 months ago
Abhinav Dixit
Aug 23, 2015

The total number of words that can be formed using R, A, N, K are 4! i.e. 24.

Now the words that can be formed after RANK are RKAN, RKNA, RNAK, RNKA.

So RANK's "rank" is 24 -4 = 20

What about RAKN? If you hold the first letter, e.g. R, then there are 3 x 2 x 1 = 6 other possibilities to form the letters. RANK therefor has in total 6 permutations (RANK included). This applies to ALL of the four letters. Which means that 24 should be divided by 4, to know that there are 6 groups starting with the same letter.

Pieter Breughel - 4 years, 9 months ago
Jeffrey Zwart
Jun 4, 2018

4x3x2x1 = 24 words in total, of which 6 start with an A, 6 start with a k and 6 with an N. There are also 6 words starting with an R. A is the first letter in the alphabet, so RAKN is the 19th word. RANK is therefore the 20th word.

if we rank the letters of the word RANK alphabetically: A = first, K = second, N = third and R = fourth.

We can form 4 ! = 24 4!=24 words.

no. of words that starts with A = 1 ( 3 ) ( 2 ) ( 1 ) = 6 1(3)(2)(1)=6

no. of words that starts with K = 1 ( 3 ) ( 2 ) ( 1 ) = 6 1(3)(2)(1)=6

no. of words that starts with N = 1 ( 3 ) ( 2 ) ( 1 ) = 6 1(3)(2)(1)=6

we are finished with the 18 18 positions

next word is

R A K N RAKN ---> 19 t h 19th p o s i t i o n position

then

R A N K RANK ---> 20 t h 20th p o s i t i o n position

Alejandro Bodhert
Oct 19, 2016

c++ code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <bits/stdc++.h>
using namespace std;

int main()
{
  string word = "RANK";
  sort(word.begin(),word.end());
  int i = 1;
  do
  {
    i++;
  }while(next_permutation(word.begin(), word.end()) && word != "RANK");
  cout << "Order: " << i++ << " " <<word << '\n';
  return 0;
}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...