Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vineetagarwal-code/100xdev-assignments


https://github.com/vineetagarwal-code/100xdev-assignments

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

        

# Hashing - DSA Questions

## Question 1: Find the First Non-Repeating Character in a String

### Problem Statement:
Given a string `s`, find the first non-repeating character in it and return its index. If it does not exist, return `-1`.

### Instructions:
1. The function should be named `firstNonRepeatingCharacter`.
2. The function should take a single parameter:
- `s` (a string, 1 ≤ length(s) ≤ 10^5)
3. Return an integer representing the index of the first non-repeating character.

### Example:
```
# Example 1:
s = "leetcode"

# Example 2:
s = "loveleetcode"
# Expected output: 2 (The first non-repeating character is 'v' at index 2)

# Example 3:
s = "aabb"
# Expected output: -1 (There are no non-repeating characters)
```
## Question 2: Check if Two Strings are Anagrams

### Problem Statement:
Given two strings `s` and `t`, write a function to determine if `t` is an anagram of `s`.

### Instructions:
1. The function should be named `Anagram`.
2. The function takes double parameter:
- `s` (a string, 1 ≤ length(s) ≤ 10^5)
- `t` (a string, 1 ≤ length(t) ≤ 10^5)
3. Return `True` if t is an anagram of s, and `False` otherwise.

### Example:
```

# Example 1:
s = "anagram"
t = "nagaram"
# Expected output: True (Both strings are anagrams)

# Example 2:
s = "rat"
t = "car"

```