Skip to content

Commit 0418f92

Browse files
committed
Update 821.shortest-distance-to-a-character.md
1 parent 24f0086 commit 0418f92

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

problems/821.shortest-distance-to-a-character.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Python3 Code:
109109
```py
110110
class Solution:
111111
def shortestToChar(self, S: str, C: str) -> List[int]:
112-
pre = -20000
112+
pre = -10000
113113
ans = []
114114

115115
for i in range(len(S)):
@@ -129,7 +129,7 @@ class Solution {
129129
public int[] shortestToChar(String S, char C) {
130130
int N = S.length();
131131
int[] ans = new int[N];
132-
int prev = -20000;
132+
int prev = -10000;
133133

134134
for (int i = 0; i < N; ++i) {
135135
if (S.charAt(i) == C) prev = i;
@@ -154,7 +154,7 @@ class Solution {
154154
public:
155155
vector<int> shortestToChar(string S, char C) {
156156
vector<int> ans(S.size(), 0);
157-
int prev = -20000;
157+
int prev = -10000;
158158
for(int i = 0; i < S.size(); i ++){
159159
if(S[i] == C) prev = i;
160160
ans[i] = i - prev;

0 commit comments

Comments
 (0)