{{ message }}

Instantly share code, notes, and snippets.

# lazywithclass/blog-post.md

Last active Apr 14, 2017
[RC Diary] Interviews (-46)

## [RC Diary] Interviews (-46)

### Interviews

#### Code

Today I've learned that I should apply my interview tools

• can I relax some of the contraints on the result?
• can I approach it in more time / more space?
• can I assume I have crucial functions that would lead me towards a solution?

everytime I get stuck. Even when I'm baffled by the complexity of a problem: for example today I was given a mathematical problem, that was presented more or less like:

You are given `f(x) = ( a * ( b - x ) ) % m`, how would you go and implement a function that tells you the length of the repeating sequence?

So, the key points here are two:

• `f(x) = ( a * ( b - x ) ) % m` could be simplified as `f(x) = x % m`
• `%` works like this `0 % 3 == 0`, `1 % 3 == 1`, `2 % 3 == 0`, `3 % 3 == 0`, `4 % 3 == 1`

it is clear now that `%` repeats a sequence. So that was the key to go through the problem.

#### Architecture

I've been asked to show how I would implement an url shortener, I feel like it went better than the last time. Last time it was in an interview, I think 1.5 years ago, so many thing changed since then.