程序媛詹妮弗
终身学习
摘要: Stack特点: 先入后出(FILO) Stack常见的创建方式: Stack<Character> stack = new Stack<>() Stack常见操作: stack.size()stack.isEmpty() stack.push(val) stack.pop() //在该操作前,确保 阅读全文
posted @ 2020-12-29 11:50 程序媛詹妮弗 阅读(84) 评论(0) 推荐(0) 编辑
摘要: Two Pointers(指针i扫旧, 指针start上新)模板: *用指针start帮助生成新数组。指针start指向下一个即将生成的,符合条件的元素的位置。 // save a position for next valid item *用指针i扫给定数组A *若扫到的A[i]符合新数组对元素的 阅读全文
posted @ 2020-12-29 05:58 程序媛詹妮弗 阅读(142) 评论(0) 推荐(0) 编辑
摘要: Given an array of n integers nums and an integer target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition  阅读全文
posted @ 2020-12-29 05:36 程序媛詹妮弗 阅读(115) 评论(0) 推荐(0) 编辑
摘要: K Sum模板: *如果返回特定index,用HashMap *如果返回组合本身且 K > 2, 无论如何先Arrays.sort(nums), 再降为TwoSum问题(指针对撞) public int[] twoSumII(int[] numbers, int target) { int i = 阅读全文
posted @ 2020-12-29 05:16 程序媛詹妮弗 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function 阅读全文
posted @ 2020-12-29 05:12 程序媛詹妮弗 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Sliding Window模板 public int slidingWindowTemplate(String s, String t) { Map<Character, Integer> map = new HashMap<>(); int result = 0; int counter = m 阅读全文
posted @ 2020-12-29 03:15 程序媛詹妮弗 阅读(81) 评论(0) 推荐(0) 编辑
摘要: Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. 阅读全文
posted @ 2020-12-29 02:58 程序媛詹妮弗 阅读(148) 评论(0) 推荐(0) 编辑