摘要: 题目地址: "https://leetcode cn.com/problems/two sum/" 1.暴力解法 直接双重循环,枚举出所有可能的解,时间复杂度为O(n^2),空间复杂度为O(1) 2.HashTable 第一次循环将数组nums中的每个数都放入map中 第二次循环判断target n 阅读全文
posted @ 2020-04-16 23:54 郭励之 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 1.TypeScript版本 js export default class MyArray { public data: E[]; public size: number = 0; / 构造函数,传入数组的容量capacity @param {number} capacity 数组容量,默认10 阅读全文
posted @ 2020-04-16 20:42 郭励之 阅读(242) 评论(0) 推荐(0) 编辑