Given a string s, find the first non-repeating character in it and return its index.
If no such character exists, return -1.
Input: s = "edSlash"
Output: 0
Explanation: 'e' is the first non-repeating character.
Input: s = "loveedSlash"
Output: 1
Explanation: 'v' is the first non-repeating character.
Input: s = "aabb"
Output: -1
Explanation: All characters are repeating.
s consists of only lowercase English letters.def firstUniqChar(s: str) -> int:
pass
"z" → 0"aabbcc" → -1"aabbccddeffg" → 10 ('g')"x" + "a"*99999 → 0"a"*99999 + "x" → 99999Given two strings s and t, return True if t is an anagram of s, and False otherwise.
An anagram is a word or phrase formed by rearranging the letters of another word, using all the original letters exactly once.
Input: s = "listen", t = "silent"
Output: True
Explanation: Both words contain the same letters with the same frequencies.
Input: s = "rat", t = "car"
Output: False
Explanation: Characters differ.
Input: s = "edSlash", t = "dashSel"
Output: True
Explanation: Both strings use the same characters in different order (case-insensitive).
def isAnagram(s: str, t: str) -> bool:
pass
s = "a", t = "a" → Trues = "a", t = "A" → Trues = "abc", t = "abcc" → Falses = "Dormitory", t = "DirtyRoom" → TrueGiven a list of integers nums, remove all duplicates while preserving the original order of appearance.
Return the new list.
Input: nums = [1, 2, 3, 2, 1, 4]
Output: [1, 2, 3, 4]
Explanation: Duplicates 2 and 1 are removed but order is preserved.
Input: nums = [5, 5, 5, 5]
Output: [5]
Explanation: All elements are same.
Input: nums = [10, 20, 10, 30, 40, 30]
Output: [10, 20, 30, 40]
Explanation: First occurrences kept in the same order.
Input: nums = [1, 2, 3, 1, 2, 3, 4, 5, 6, 4, 5, 6, 7]
Output: [1, 2, 3, 4, 5, 6, 7]
Explanation: Only unique sequence remains.
Input: nums = ['e', 'd', 'S', 'l', 'a', 's', 'h', 'e', 'd']
Output: ['e', 'd', 'S', 'l', 'a', 's', 'h']
Explanation: For 'edSlash', duplicates 'e' and 'd' are removed while keeping the first occurrence.
def remove_duplicates(nums: list) -> list:
pass
Hidden Test Cases
nums = [] → []nums = [1] → [1]nums = list(range(1000000)) → same list (no duplicates)nums = [1, 2, 2, 3, 3, 3] → [1, 2, 3]nums = ['a', 'A', 'a'] → ['a', 'A'] (case-sensitive)© 2021 edSlash. All Rights Reserved.