Skip to content

Commit 0021ca9

Browse files
authored
feat: add solutions to lc problem: No.2568 (doocs#906)
No.2568.Minimum Impossible OR
1 parent 4402929 commit 0021ca9

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

solution/2500-2599/2568.Minimum Impossible OR/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,22 @@ func minImpossibleOR(nums []int) int {
114114
}
115115
```
116116

117+
### **TypeScript**
118+
119+
```ts
120+
function minImpossibleOR(nums: number[]): number {
121+
const s: Set<number> = new Set();
122+
for (const x of nums) {
123+
s.add(x);
124+
}
125+
for (let i = 0; ; ++i) {
126+
if (!s.has(1 << i)) {
127+
return 1 << i;
128+
}
129+
}
130+
}
131+
```
132+
117133
### **...**
118134

119135
```

solution/2500-2599/2568.Minimum Impossible OR/README_EN.md

+16
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,22 @@ func minImpossibleOR(nums []int) int {
9898
}
9999
```
100100

101+
### **TypeScript**
102+
103+
```ts
104+
function minImpossibleOR(nums: number[]): number {
105+
const s: Set<number> = new Set();
106+
for (const x of nums) {
107+
s.add(x);
108+
}
109+
for (let i = 0; ; ++i) {
110+
if (!s.has(1 << i)) {
111+
return 1 << i;
112+
}
113+
}
114+
}
115+
```
116+
101117
### **...**
102118

103119
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function minImpossibleOR(nums: number[]): number {
2+
const s: Set<number> = new Set();
3+
for (const x of nums) {
4+
s.add(x);
5+
}
6+
for (let i = 0; ; ++i) {
7+
if (!s.has(1 << i)) {
8+
return 1 << i;
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)