Array解题方法小结

LeetCode上的相关题目(easy)

26,  27, 35, 48, 88

118, 119, 121, 122, 136, 162, 167, 169

217, 219, 243, 268, 283

303, 349, 350

414, 448, 453, 485, 496

532, 561, 566, 575, 581, 594

605, 624, 628

Medium题目

49, 287

常用方法

  • new ArrayList(Arrays.asList(array))
  • Integer.MAX_VALUE
  • Integer.MIN_VALUE
  • Math.abs()
  • .clone()

技巧

  • 如果需要记录数量的时候,无法使用hashset,可以用hashmap -> k=n, v=count
  • 使用hashmap计数的时候时候,切忌加上<Integer,Integer>
  • 碰到遍历找位置的,可以使用插入法,改变array的数值

需要Review的题目

This site Original article All followed" Attribution—NonCommercial—ShareAlike 4.0 (CC BY-NC-SA 4.0) ”。 Please keep the following marks for sharing and interpretation:

Original author: Jake Tao Source: 「Array解题方法小结」

Praise 164
0 0 164

Further reading

Post a reply

Log in can only be commented on later
Share this page
Back to top