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

  • Home
  • SEARCH
  • 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 8447623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:13:30+00:00 2026-06-10T10:13:30+00:00

In a recent competition organized by AmDocs , I came across the following question

  • 0

In a recent competition organized by “AmDocs” , I came across the following question : (The basic Idea of the question)

You are a given a matrix of fixed size 12×12.
You are given six line segments of length 6,5,5,4,3,2.
The matrix has empty spaces and filled spaces.
You have to return “Yes” Or “No” , whether all the 6 line segments can be fit into the matrix simultaneously or not.
The lines can be placed horizontally or vertically Only.

What algorithm should be used to solve this problem ? Packing ? Knapsack ?

  • 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-06-10T10:13:31+00:00Added an answer on June 10, 2026 at 10:13 am

    I would map the problem to SAT and use a SAT solver. There is a pretty natural mapping. Define the variables:

    x_s_i_j_d = segment s starts at coordinates (i,j) and goes in direction d
    

    (d is “right” or “down”)

    First, iterate over all the segments and starting positions, and see which are viable given the starting matrix.
    example, M:

    000000000000
    111111111111
    ...
    

    if segment 1 is length 2, then L_seg1_0_0_down = false, because it hits a filled space.

    Then, write clauses that prohibit two crossing segments. If segment 1 and segment 2 are both length 2, then we add the clause:

    (!L_seg1_0_0_right || !L_seg2_1_0_right)
    

    because if segment 1 uses coordinates (0,0), and (1,0), then segment 2 can’t use (1,0) also.

    finally, add the condition that each segment must be used at least once:

    (L_seg1_0_0_right || L_seg1_0_1_right || ...)
    

    for all the positions that seg1 can go. Then throw your favorite SAT solver at it.

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

Sidebar

Related Questions

I recent came across Javascript templates and have become quite intrigued. I am building
A recent question came up about using String.Format(). Part of my answer included a
Following recent hardware problems, I attempted to switch a couple of our websites to
A recent post by John Gruber notes that the following legalese: 3.3.1 — Applications
A recent question contains a problem that I many times used to think about
In several recent answers I see this code given as the way to retrieve
Inspired by the recent question about 2d grids in Haskell, I'm wondering if it
In recent talk with client, we got an interesting question, if we are able
A recent crash prompted this question - I had two gui windows open. Is
Recent interview question is If C# language allow us create partial delegates what are

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.