EPIJudge icon indicating copy to clipboard operation
EPIJudge copied to clipboard

Simplified and a bit more optimized solution

Open FusionX9000 opened this issue 5 years ago • 1 comments

Using map's getOrDefault significantly reduces conditional checks required. I have also modified the solution a bit to only require a single pass. Further, since we're adding the results in a single pass, we don't care about swapping/changing indexes before the current index, which also halves hash table modifications required.

This is my first pull request, so I apologize in advance if I made a mistake.

FusionX9000 avatar Jan 16 '20 04:01 FusionX9000

Hi @FusionX9000 ,

Very good solution to simplify the code, and I am impressed. We will merge that in the future, and please be patient on this.

tsunghsienlee avatar Jan 26 '20 23:01 tsunghsienlee