Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : Update README_EN.md to lc problem: No.1535 #1929

Merged
merged 4 commits into from
Nov 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat : Update README_EN.md to lc problem: No.1535
  • Loading branch information
dev-mauli authored Nov 5, 2023
commit 0a3c88836f972ebbc5f6e05dd044efdaa3e74ba1
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,28 @@ function getWinner(arr: number[], k: number): number {
return mx;
}
```
### **C#**

```c#
public class Solution {
public int GetWinner(int[] arr, int k) {
int maxElement = arr[0], count = 0;
for (int i = 1; i < arr.Length; i++) {
if (maxElement < arr[i]){
maxElement = arr[i];
count = 1;
}
else {
count++;
}
if (count == k) {
break;
}
}
return maxElement;
}
}
```

### **...**

Expand Down