Skip to content

Commit 98bcafc

Browse files
Adding the ContainsDuplicate.dart file
1 parent 1506fb4 commit 98bcafc

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

ContainsDuplicate.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Problem: Leetcode solution using Dart language for the problem Contains Duplicate (Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.)
2+
// Result: Runtime: 2201 ms, faster than 15.96% of Dart online submissions for Contains Duplicate; Memory Usage: 183.7 MB, less than 7.51% of Dart online submissions for Contains Duplicate.
3+
4+
// Solution:
5+
6+
class Solution {
7+
bool containsDuplicate(List<int> nums) {
8+
for(int i=0;i<nums.length;i++){
9+
for(int j=i+1;j<nums.length;j++){
10+
if(nums[i]==nums[j]){
11+
return true;
12+
}
13+
}
14+
}
15+
return false;
16+
}
17+
}

0 commit comments

Comments
 (0)