美文网首页
LeetCode 26:删除排序数组中的重复项

LeetCode 26:删除排序数组中的重复项

作者: p_w | 来源:发表于2020-03-15 18:15 被阅读0次

【记录性文章】
第一版方法:主要思路是使用了双层循环,时间复杂度O(n^2)


image.png

运行明细:

image.png
image.png

第二版方法:


image.png

运行明细:


image.png image.png

总结:

第二版方法灵活使用了数组下标。数组下标是一个很灵活的变量,在解决数组问题时要想到。

相关文章

网友评论

      本文标题:LeetCode 26:删除排序数组中的重复项

      本文链接:https://www.haomeiwen.com/subject/klfpehtx.html