659. Split Array into Consecutive Subsequences

659. Split Array into Consecutive Subsequences

 

  1. We iterate through the array once to get the frequency of all the elements in the array
  2. We iterate through the array once more and for each element we either see if it can be appended to a previously constructed consecutive sequence or if it can be the start of a new consecutive sequence. If neither are true, then we return false.

posted on 2018-11-08 16:32  猪猪🐷  阅读(84)  评论(0)    收藏  举报

导航