#who can solve this hackerrank Pb using mathematics ?

5 messages · Page 1 of 1 (latest)

fast bough
#

Hi , I came across this challenge in hackerrank , it is a bit challenging , and it fits to be a math problem in my opinion , so I wonder if we can solve it using a mathematical expression .

the problem : https://www.hackerrank.com/challenges/lego-blocks/problem

I figured out the solution for n>1 and m<=4 which is : ((2^n)-1)^(m-1)
but I want a general solution for any n and any m.

this is my method (I prefer solving it by your own , I am afraid you read my method and feel overwhelmed unless you are super intelligent you read people's mind and how they think )
I used this tree of possibilities :

I suppose we use just 1x1 lego , for n, m we have n stacks of lego and (m-1) vertical lines (vertical breaks between lego of 1x1) if we suppose that merge 2 adjancent lego can remove the break so we have (2^n) -1 possibility in the first straight line (we have 2 options leave the break or merge so 2^n , but we cannot leave the breaks to form a straight line so we remove this possibility ) .
using possibilities counting for the first condition , but the second condition of the problem is broken once m>4 , because there is a constraint is the tree of possibilities vertically (we cannot have a straight line between legos) and also horizontally (we have have limited option of merge block that I didn't hold accountable , cannot merge blocks to have more than 5 blocks included )

formal kayakBOT
#
  1. Do not ping the Moderators, unless someone is breaking the rules.
  2. Do not ping the Helper Moderators, unless there is a conflict between helpers.
  3. Do not ping other members randomly for help.
  4. Ask your question and show the work you've done so far. If you've posted a screenshot of a question, specify which part you need help with.
  5. Wait patiently for a helper to come along.
  6. If the Helper has answered your question, remember to thank them with the Mathematics Ranks bot and close the thread with:

+close
Feel free to nominate the person for helper of the week in #helper-nominations
If you're happy with the help you got here, and the server overall, you can contribute financially as well:

prisma sparrowBOT
#

@fast bough

:HelpIcon:| Help Reminder

Hello mou3mida, this is a friendly reminder that your help request has been inactive for more than 24 hours. If you no longer need assistance, please consider closing the thread using the +close command. This thread will be automatically closed in 3 days if it remains inactive.

prisma sparrowBOT
#
Wait for Helpers

Please wait for any potential Helpers to respond or you can close the thread.