8000 Grouped solutions by level and added descriptions · jonasraoni/leetcode@c1351af · GitHub
[go: up one dir, main page]

Skip to cont 8000 ent

Commit c1351af

Browse files
committed
Grouped solutions by level and added descriptions
1 parent 6477d59 commit c1351af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+818
-0
lines changed
File renamed without changes.

easy/containsDuplicate.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# [217. Contains Duplicate](https://leetcode.com/problems/contains-duplicate)
2+
3+
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.
4+
5+
6+
7+
Example 1:
8+
9+
Input: nums = [1,2,3,1]
10+
Output: true
11+
Example 2:
12+
13+
Input: nums = [1,2,3,4]
14+
Output: false
15+
Example 3:
16+
17+
Input: nums = [1,1,1,3,3,4,3,2,4,2]
18+
Output: true
19+
20+
21+
Constraints:
22+
23+
1 <= nums.length <= 105
24+
-109 <= nums[i] <= 109
File renamed without changes.

easy/firstUniqChar.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# [387. First Unique Character in a String](https://leetcode.com/problems/first-unique-character-in-a-string)
2+
3+
Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1.
4+
5+
6+
7+
Example 1:
8+
9+
Input: s = "leetcode"
10+
Output: 0
11+
Example 2:
12+
13+
Input: s = "loveleetcode"
14+
Output: 2
15+
Example 3:
16+
17+
Input: s = "aabb"
18+
Output: -1
19+
20+
21+
Constraints:
22+
23+
1 <= s.length <= 105
24+
s consists of only lowercase English letters.
File renamed without changes.

easy/intersect.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# [350. Intersection of Two Arrays II](https://leetcode.com/problems/intersection-of-two-arrays-ii)
2+
3+
Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order.
4+
5+
Example 1:
6+
7+
Input: nums1 = [1,2,2,1], nums2 = [2,2]
8+
Output: [2,2]
9+
Example 2:
10+
11+
Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4]
12+
Output: [4,9]
13+
Explanation: [9,4] is also accepted.
14+
15+
Constraints:
16+
17+
1 <= nums1.length, nums2.length <= 1000
18+
0 <= nums1[i], nums2[i] <= 1000
19+
20+
Follow up:
21+
22+
What if the given array is already sorted? How would you optimize your algorithm?
23+
What if nums1's size is small compared to nums2's size? Which algorithm is better?
24+
What if elements of nums2 are stored on disk, and the memory is limited such that you cannot load all elements into the memory at once?
File renamed without changes.

easy/isAnagram.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# [242. Valid Anagram](https://leetcode.com/problems/valid-anagram)
2+
3+
Given two strings s and t, return true if t is an anagram of s, and false otherwise.
4+
5+
An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
6+
7+
8+
9+
Example 1:
10+
11+
Input: s = "anagram", t = "nagaram"
12+
Output: true
13+
Example 2:
14+
15+
Input: s = "rat", t = "car"
16+
Output: false
17+
18+
19+
Constraints:
20+
21+
1 <= s.length, t.length <= 5 * 104
22+
s and t consist of lowercase English letters.
23+
24+
25+
Follow up: What if the inputs contain Unicode characters? How would you adapt your solution to such a case?
File renamed without changes.

easy/isIsomorphic.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# [205. Isomorphic Strings](https://leetcode.com/problems/isomorphic-strings)
2+
3+
Given two strings s and t, determine if they are isomorphic.
4+
5+
Two strings s and t are isomorphic if the characters in s can be replaced to get t.
6+
7+
All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself.
8+
9+
10+
11+
Example 1:
12+
13+
Input: s = "egg", t = "add"
14+
Output: true
15+
Example 2:
16+
17+
Input: s = "foo", t = "bar"
18+
Output: false
19+
Example 3:
20+
21+
Input: s = "paper", t = "title"
22+
Output: true
23+
24+
25+
Constraints:
26+
27+
1 <= s.length <= 5 * 104
28+
t.length == s.length
29+
s and t consist of any valid ascii character.

0 commit comments

Comments
 (0)
0