Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6994189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:51:38+00:00 2026-05-27T19:51:38+00:00

I’m working on a problem right now and am having a bit of trouble.

  • 0

I’m working on a problem right now and am having a bit of trouble.

Here’s the question:

enter image description here

I’ve gotten to a point in the program where I can generate all possible rows for a given length and can calculate the number of other rows that align with each other. I can calculate base cases fairly quick, but my program is very naive and calculates walls recursively, with each of the possible rows as bases of a wall and which builds walls recursively on each possible leaf combination. As you can imaging, this isn’t very efficient, and for anything above height 6 my program takes a very, very long time.

I’ve seen this problem on the forum from an earlier, but my question wasn’t really answered and I couldn’t reply to it. Help/ideas is/are greatly appreciated.

Oh, and I’m writing the program in c++.

EDIT: I’m having a lot of trouble, could someone look at my code and suggest improvements?

EDIT2: Ok, I have an answer now, I get 806844323190414 possible walls for a 48×10 inch wall. If anyone wants, I can post post my methodology/code, or just general advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:51:39+00:00Added an answer on May 27, 2026 at 7:51 pm

    Observe that when you have built k rows, it’s only the topmost (k th) row that restricts what the next row may look like. Consider the question “when I have built k rows and the topmost row looks like x, in how many ways can I build the remaining wall?” This can be solved by asking the same question for all compatible ways of making the k+1 th row and summing the results. The answer to the entire problem is the sum of the answers to the questions “When I have built 1 row and the topmost row looks like x“, for all possible ways of building the first row. This problem can be solved using memoization or dynamic programming.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
This could be a duplicate question, but I have no idea what search terms
I've tracked down a weird MySQL problem to the two different ways I was
I don't have much knowledge about the IPv6 protocol, so sorry if the question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.