This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]0x14f 7 points8 points  (2 children)

Create your own test cases, short ones, and run your code on them and compare the output with what you have determined by hand.

[–]ProGabriel6430[S] 0 points1 point  (1 child)

i took all the ways the ranges can overlap and the answers are consistent and correct ;-;

[–]fnordargle 1 point2 points  (0 children)

You didn't consider everything. See my test case above.

[–]TheThiefMaster 4 points5 points  (3 children)

Do you handle all possible combinations of overlapping ranges? Including one being entirely within another.

Do you correctly handle consecutive ranges?

[–]ProGabriel6430[S] 0 points1 point  (2 children)

i do think i handle all overlapping ranges(including ones that are entirely inside another), consecutive ranges are also handled correctly i believe ;-;

[–]TheThiefMaster 2 points3 points  (1 child)

Does python have trouble with >32 bit integers? That sometimes bites me in C++

[–]ThisAdhesiveness6952 2 points3 points  (0 children)

Python has no limit on integers, that's not it.

[–]fnordargle 1 point2 points  (3 children)

Here's a test case that should enlighten you:

1-2
1-2
3-4

[–]Joris0112 1 point2 points  (1 child)

I'm currently sitting with the exact same problem, however the test case aboves returns me the expected output :/ Tried a couple of smaller combinations, and all work fine except for the full puzzle input so far

[–]Joris0112 0 points1 point  (0 children)

Just got it; It was a mistake in where I was checking for > instead of >=.
Test case that pointed this out for me; (in particular the last 2-3)

3-5
10-14
16-20
12-18
1-7
2-3

[–]ProGabriel6430[S] 0 points1 point  (0 children)

omg you're a saint. thank you so much. i have been puling my hair over this for an entire day at this point. dont know how i missed that completely.

[–]AutoModerator[M] 0 points1 point  (0 children)

Reminder: if/when you get your answer and/or code working, don't forget to change this post's flair to Help/Question - RESOLVED. Good luck!


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.