From a2db924e0069f8fce0495dee994655b8571ef416 Mon Sep 17 00:00:00 2001 From: Tim Gates Date: Tue, 9 Nov 2021 20:33:45 +1100 Subject: [PATCH] docs: Fix a few typos There are small typos in: - anagrams/solution.py - jump_game_ii/solution3.py - search_for_a_range/solution2.py Fixes: - Should read `occurrence` rather than `occurence`. - Should read `occurrences` rather than `occurences`. - Should read `minimum` rather than `mininum`. --- anagrams/solution.py | 4 ++-- jump_game_ii/solution3.py | 2 +- search_for_a_range/solution2.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/anagrams/solution.py b/anagrams/solution.py index 25421f4..77e6836 100644 --- a/anagrams/solution.py +++ b/anagrams/solution.py @@ -6,7 +6,7 @@ def anagrams(self, strs): res = [] for i, s in enumerate(strs): key = self.make_key(s) - # First occurence of an anagram + # First occurrence of an anagram if key not in d: d[key] = [s] else: @@ -26,7 +26,7 @@ def make_key(self, s): else: d[c] = 1 # Iterate form 'a' to 'z' - # This make sure the character occurences is ordered + # This make sure the character occurrences is ordered # and thus unique for i in range(ord('a'), ord('z') + 1): c = chr(i) diff --git a/jump_game_ii/solution3.py b/jump_game_ii/solution3.py index 391b909..896776a 100644 --- a/jump_game_ii/solution3.py +++ b/jump_game_ii/solution3.py @@ -23,7 +23,7 @@ def jump(self, nums): Time Limit Exceeded """ n = len(nums) - # t[i] means mininum number of jumps to nums[i] + # t[i] means minimum number of jumps to nums[i] t = [-1 for i in range(n)] t[0] = 0 if n == 1: diff --git a/search_for_a_range/solution2.py b/search_for_a_range/solution2.py index eca7d2a..307ecfc 100644 --- a/search_for_a_range/solution2.py +++ b/search_for_a_range/solution2.py @@ -23,7 +23,7 @@ def searchRange(self, nums, target): right = n - 1 left_res = -1 right_res = -1 - # Search for left bound (first occurence of target) + # Search for left bound (first occurrence of target) while left + 1 < right: mid = left + (right - left) / 2 if target > nums[mid]: @@ -37,7 +37,7 @@ def searchRange(self, nums, target): else: return [-1, -1] - # Search for right bound (last occurence of target) + # Search for right bound (last occurrence of target) left = 0 right = n - 1 while left + 1 < right: