Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 095971d

Browse files
feat: add cs solution to lc problem: No.2849 (doocs#1943)
1 parent 9b9643e commit 095971d

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

‎solution/2800-2899/2849.Determine if a Cell Is Reachable at a Given Time/README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ function isReachableAtTime(sx: number, sy: number, fx: number, fy: number, t: nu
126126
}
127127
```
128128

129+
### **C#**
130+
131+
```cs
132+
public class Solution {
133+
public bool IsReachableAtTime(int sx, int sy, int fx, int fy, int t) {
134+
if (sx == fx && sy == fy)
135+
return t != 1;
136+
return Math.Max(Math.Abs(sx - fx), Math.Abs(sy - fy)) <= t;
137+
}
138+
}
139+
```
140+
129141
### **...**
130142

131143
```

‎solution/2800-2899/2849.Determine if a Cell Is Reachable at a Given Time/README_EN.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ function isReachableAtTime(sx: number, sy: number, fx: number, fy: number, t: nu
116116
}
117117
```
118118

119+
### **C#**
120+
121+
```cs
122+
public class Solution {
123+
public bool IsReachableAtTime(int sx, int sy, int fx, int fy, int t) {
124+
if (sx == fx && sy == fy)
125+
return t != 1;
126+
return Math.Max(Math.Abs(sx - fx), Math.Abs(sy - fy)) <= t;
127+
}
128+
}
129+
```
130+
119131
### **...**
120132

121133
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class Solution {
2+
public bool IsReachableAtTime(int sx, int sy, int fx, int fy, int t) {
3+
if (sx == fx && sy == fy)
4+
return t != 1;
5+
return Math.Max(Math.Abs(sx - fx), Math.Abs(sy - fy)) <= t;
6+
}
7+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /