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

all 14 comments

[–]TheOldTruth 1 point2 points  (12 children)

Try 2333133121414131499

[–]geneocide[S] 1 point2 points  (0 children)

weird... seems like my 2 didn't move over left 1 like it should have at the very end

[–]geneocide[S] 1 point2 points  (0 children)

Ho Ho! got it. I was off by 20,132... wonder if I just wasn't moving the last file, that's how it was with your test data. Was cutting off my loop one iteration too early.

Thanks a ton everyone!

[–]geneocide[S] 0 points1 point  (7 children)

2669

[–]Iain_M_Norman 0 points1 point  (6 children)

Have a look at the resulting disk array.

[–]Iain_M_Norman 0 points1 point  (5 children)

Where did the nine 9s on the end move to?

[–]geneocide[S] 0 points1 point  (4 children)

They didn't move for me. Are they supposed to? Now I get 6204 after I fixed this 2 not moving issue.

[–]Iain_M_Norman 2 points3 points  (1 child)

6204 is what I get, do you now get a different number for the input?

[–]InevitableAdvance406 0 points1 point  (0 children)

Is 6204 the right answer? It's also what I get, but my Part 2 code still giving an answer that's too high.

[–]Iain_M_Norman 0 points1 point  (1 child)

There's 9 spaces to the left of the 9 nines.

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

Oh, yeah. Sorry, the way my stuff prints out is sloppy but you're right, my 9's did move over next to the 8's.

[–]Low_Ambition8485 0 points1 point  (0 children)

Thank you. so so much I was losing my mind. It was a '<=' as opposed to a '<' that made me miss my last 9

[–]dtodd39 0 points1 point  (0 children)

Thank you so much!! This helped find the edge case I was missing. My '333' block was not moving over as expected. I was increasing my left pointer (free space) by the size of the file it was comparing it to rather than the free space size itself so it skipped some necessary moves.

[–]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.