73 lines
1.6 KiB
Markdown
73 lines
1.6 KiB
Markdown
|
# IBM Data Scientist Interview
|
|||
|
|
|||
|
There are several types of questions they might ask.
|
|||
|
|
|||
|
This is a[ good website](https://www.interviewquery.com/dashboard/home) to check out to try to prep for the interview.
|
|||
|
|
|||
|
---
|
|||
|
|
|||
|
### String Mapping
|
|||
|
|
|||
|
algorithms
|
|||
|
|
|||
|
Easy
|
|||
|
|
|||
|
[Answer now](https://www.interviewquery.com/questions/string-mapping)
|
|||
|
|
|||
|
Given two strings, `string1` and `string2`, write a function `str_map` to determine if there exists a one-to-one correspondence (bijection) between the characters of `string1` and `string2`.
|
|||
|
|
|||
|
For the two strings, our correspondence must be between characters in the same position/index.
|
|||
|
|
|||
|
**Example 1:**
|
|||
|
|
|||
|
**Input:**
|
|||
|
|
|||
|
```python
|
|||
|
string1 = 'qwe'
|
|||
|
string2 = 'asd'
|
|||
|
|
|||
|
string_map(string1, string2) == True
|
|||
|
|
|||
|
# q = a, w = s, and e = d
|
|||
|
```
|
|||
|
|
|||
|
**Example 2:**
|
|||
|
|
|||
|
**Input:**
|
|||
|
|
|||
|
```python
|
|||
|
string1 = 'donut'
|
|||
|
string2 = 'fatty'
|
|||
|
|
|||
|
string_map(string1, string2) == False
|
|||
|
# cannot map two distinct characters to two equal characters
|
|||
|
```
|
|||
|
|
|||
|
**Example 3:**
|
|||
|
|
|||
|
**Input:**
|
|||
|
|
|||
|
```python
|
|||
|
string1 = 'enemy'
|
|||
|
string2 = 'enemy'
|
|||
|
|
|||
|
string_map(string1, string2) == True
|
|||
|
# there exists a one-to-one correspondence between equivalent strings
|
|||
|
```
|
|||
|
|
|||
|
**Example 4:**
|
|||
|
|
|||
|
**Input:**
|
|||
|
|
|||
|
```python
|
|||
|
string1 = 'enemy'
|
|||
|
string2 = 'ymene'
|
|||
|
|
|||
|
string_map(string1, string2) == False
|
|||
|
# since our correspondence must be between characters of the same index, this case returns 'False' as we must map e = y AND e = e
|
|||
|
```
|
|||
|
|
|||
|
### Total Transactions
|
|||
|
- a good [SQL Hackerrank article ](https://towardsdatascience.com/9-tips-that-helped-me-clear-all-hackerrank-sql-challenges-in-2-weeks-479eb0084862) via Medium
|
|||
|
|
|||
|
How would you deal with outliers when training a model?
|