Skip to content

Commit 3efd103

Browse files
SinnoLnheyhyo11
authored andcommitted
3978. Unique Middle Element
1 parent 1b3f60c commit 3efd103

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public boolean isMiddleElementUnique(int[] nums) {
3+
int target = nums[nums.length/2];
4+
for(int i=0; i<nums.length; i++) {
5+
if(i == nums.length/2) continue;
6+
if(nums[i] == target) return false;
7+
}
8+
9+
return true;
10+
}
11+
}

0 commit comments

Comments
 (0)