Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e2565d3

Browse files
solves #2549: Count Distinct Numbers on Board in java
1 parent 989025d commit e2565d3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@
797797
| 2535 | [Difference Between Element Sum and Digit Sum of an Array](https://leetcode.com/problems/difference-between-element-sum-and-digit-sum-of-an-array) | [![Java](assets/java.png)](src/DifferenceBetweenElementSumAndDigitSumOfAnArray.java) | |
798798
| 2540 | [Minimum Common Value](https://leetcode.com/problems/minimum-common-value) | [![Java](assets/java.png)](src/MinimumCommonValue.java) | |
799799
| 2544 | [Alternating Digit Sum](https://leetcode.com/problems/alternating-digit-sum) | [![Java](assets/java.png)](src/AlternatingDigitSum.java) | |
800-
| 2549 | [Count Distinct Numbers on Board](https://leetcode.com/problems/count-distinct-numbers-on-board) | | |
800+
| 2549 | [Count Distinct Numbers on Board](https://leetcode.com/problems/count-distinct-numbers-on-board) | [![Java](assets/java.png)](src/CountDistinctNumbersOnBoard.java) | |
801801
| 2553 | [Separate the Digits in an Array](https://leetcode.com/problems/separate-the-digits-in-an-array) | | |
802802
| 2558 | [Take Gifts From the Richest Pile](https://leetcode.com/problems/take-gifts-from-the-richest-pile) | | |
803803
| 2562 | [Find the Array Concatenation Value](https://leetcode.com/problems/find-the-array-concatenation-value) | | |

src/CountDistinctNumbersOnBoard.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// https://leetcode.com/problems/count-distinct-numbers-on-board
2+
// T: O(1)
3+
// S: O(1)
4+
5+
public class CountDistinctNumbersOnBoard {
6+
public int distinctIntegers(int n) {
7+
if (n <= 2) return 0;
8+
return n - 1;
9+
}
10+
}

0 commit comments

Comments
 (0)