You are not logged in. Please login at to post your questions!



Can someone please explain me the approach to solve this problem

asked 18 Jan '18, 17:54

kunal12's gravatar image

accept rate: 0%

You need to arrange N numbers, and the arrangement must contain a given subsequence of length M. First of all, check if its possible, ie., if all the M numbers are distinct. Then, since the order in which the M numbers appear is fixed, we just need to find the number of ways in which you can put the other N-M numbers in N positions. After that, the remaining M numbers will be placed in the leftover spaces.

The number of ways in which you can put N-M numbers in N positions is Np(N-M) = N!/M!.


answered 18 Jan '18, 18:35

hemanth_1's gravatar image

accept rate: 28%

If some elements in the m sized array are same then the answer would be zero right ? Else n!/m!

(18 Jan '18, 19:33) kunal123★
(18 Jan '18, 20:45) hemanth_16★

Got it... thankyou @hemanth_1 :)

(18 Jan '18, 22:04) kunal123★

Suppose you have n=4,m=2 . You can place the remaining 2 elements in 4 * 3 ways. For n=5,m=2 ,you can place the remaining 3 elements in 5 * 4 * 3 ways.Observed some pattern?Rest I'll leave it to you to know how. You can refer this Code


answered 18 Jan '18, 18:44

stranger7's gravatar image

accept rate: 27%

edited 18 Jan '18, 18:45

Access is denied to this code :/

(18 Jan '18, 18:49) kunal123★

Who to approach this one from the same contest, help please


answered 21 Jan '18, 15:46

merajeev's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 18 Jan '18, 17:54

question was seen: 350 times

last updated: 21 Jan '18, 15:46