We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #147: Rectangles in cross-hatched grids
  4. Discussions

Project Euler #147: Rectangles in cross-hatched grids

Problem
Submissions
Leaderboard
Discussions

Sort 6 Discussions, By:

votes

Please Login in order to post a comment

  • ravigiridhar786
    6 years ago+ 0 comments

    yes, but in a 3x2 grid there are 1 possible 3x2 grid -> 37(18 upright + 19 diagonal) 6 possible 1x1 grids -> 6(6 upright + 0 diagonal) 4 possible 2x1 grids -> 16(12 upright + 4 diagonal) 2 possible 3x1 grids -> 16(12 upright + 4 diagonal) 3 possible 1x2 grids -> 12(9 upright + 3 diagonal) 2 possible 2x2 grids ->36 (18 upright + 18 diagonal) so, total = 37 +6 + 16 + 16 + 12 + 36 = 123 out of 123, 75 =(18+9+12+12+6+18) are upright and 48= (19+4+4+3+18) are diagonal

    0|
    Permalink
  • sumit_saurav
    6 years ago+ 0 comments

    It is given that the number of 1*1 grid is 1.....How is that possible ...there are so many 1*1 grid ..plz explain the terminology of 3*2,1*1 etc...

    0|
    Permalink
  • jcchuks1
    6 years ago+ 1 comment

    Please I really need clarifications with the wording of this question.

    when you say a 3x2 grid, I am thinking a grid with 3 rows and 2 columns and I cant see that here.

    Also it says "There are 5 grids smaller than 3x2, vertical and horizontal dimensions being important....",5 grids smaller? Please how do you define a grid ?

    Also where the problem said "Adding those to the 37 of the 3x2 grid, a total of 72 different rectangles" ... how did 72 come about. I can just think of 37 + 18 = 55.

    0|
    Permalink
  • itsmedurgesh
    6 years ago+ 1 comment

    Let grid size is MxN (M<=N)

    for upright rectangles of m <= M & n <= N
    number of rectangles possible is (1+(M-m))*(1+(N-n)) usin this I can get upright rectangles of all sizes.


    for diagonal rectangles I could only figure out for 1xn (and nx1) sizes.


    how to figure out rest of the diagonal rectangles?

    Any help!

    0|
    Permalink
  • jenny_2
    6 years ago+ 1 comment

    Since i'm a starter in Project Euler any suggestions for references

    0|
    Permalink
Load more conversations

Need Help?


View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature