From 03303a21ebb4d25ebb1015ea4279b508542d1c0f Mon Sep 17 00:00:00 2001 From: Pierre Marais Date: Sat, 17 Sep 2022 14:18:06 +0200 Subject: [PATCH] contents: fix typo in array cheatsheet (#299) --- contents/algorithms/array.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contents/algorithms/array.md b/contents/algorithms/array.md index 8842291c..c65ad374 100644 --- a/contents/algorithms/array.md +++ b/contents/algorithms/array.md @@ -104,7 +104,7 @@ Can you sort the array? Sometimes sorting the array first may significantly simp For questions where summation or multiplication of a subarray is involved, pre-computation using hashing or a prefix/suffix sum/product might be useful. Examples: [Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/), [Minimum Size Subarray Sum](https://leetcode.com/problems/minimum-size-subarray-sum/), [LeetCode questions tagged "prefix-sum"](https://leetcode.com/tag/prefix-sum/) -### Index has a hash key +### Index as a hash key If you are given a sequence and the interviewer asks for O(1) space, it might be possible to use the array itself as a hash table. For example, if the array only has values from 1 to N, where N is the length of the array, negate the value at that index (minus one) to indicate presence of that number. Examples: [First Missing Positive](https://leetcode.com/problems/first-missing-positive/), [Daily Temperatures](https://leetcode.com/problems/daily-temperatures/)