Skip to content

Commit 48798b1

Browse files
committed
Improve readability of interview-materials folder content
1 parent a23da8b commit 48798b1

12 files changed

+264
-218
lines changed

README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
Gradle isn't required because of embedded Gradle presence in the project
1515

16-
## How to build
16+
## How to build project
1717

1818
```shell
1919
./gradlew clean build
@@ -47,6 +47,12 @@ they contain enough code which describes implementation in a natural way.
4747
## SQL-related stuff
4848

4949
[SQL folder](sql/README.md) contains tasks which require writing SQL queries to solve them.
50+
Check appropriate [video](https://youtu.be/GjDF_LdwYHU) on Youtube
51+
52+
## Interview materials
53+
54+
The [interview-materials](interview-materials) folder contains some
55+
notes about interview preparation and useful links.
5056

5157
## Videos on [YouTube channel](https://www.youtube.com/@andd3dfx) (in chronological order)
5258

@@ -249,7 +255,3 @@ they contain enough code which describes implementation in a natural way.
249255
| Прохождение теста подтверждения практического навыка "продвинутый" по Java на hh.ru | [Youtube](https://youtu.be/ce3g0nIJl24) | - |
250256
| Поиск НОК для набора чисел | [Youtube](https://youtu.be/jR0Ei_3O7EM) | [Code](src/main/java/by/andd3dfx/numeric/LeastCommonMultiple.java) |
251257
| Число Фробениуса и задача Чикена МакНаггетса | [Youtube](https://youtu.be/itBWtCwWUG4) | [Code](src/main/java/by/andd3dfx/numeric/FrobeniusCoinProblem.java) |
252-
253-
## Materials & notes
254-
255-
The [materials folder](./materials) contains some stashed interview materials & notes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
## Before refactoring:
2+
3+
```java
4+
5+
@Service
6+
@RequiredArgsConstructor
7+
public class CommonService<S extends ExecuteService> {
8+
private final S service;
9+
10+
void process() {
11+
service.execute();
12+
}
13+
}
14+
15+
@Service
16+
@RequiredArgsConstructor
17+
public class InfoService {
18+
private final InfoProcessor service;
19+
20+
void process() {
21+
service.execute();
22+
}
23+
}
24+
25+
@Service
26+
@RequiredArgsConstructor
27+
public class RequestService {
28+
private final RequestProcessor service;
29+
30+
void process() {
31+
service.execute();
32+
}
33+
}
34+
```
35+
36+
## After refactoring:
37+
38+
```java
39+
40+
@Service
41+
@RequiredArgsConstructor
42+
public class CommonService<S extends IExecuteService> {
43+
private final S service;
44+
45+
void process() {
46+
service.execute();
47+
}
48+
}
49+
50+
public interface IExecuteService {
51+
void execute();
52+
}
53+
54+
@Service
55+
@RequiredArgsConstructor
56+
public class InfoService implements IExecuteService {
57+
private final InfoProcessor processor;
58+
59+
@Override
60+
public void execute() {
61+
processor.process();
62+
}
63+
}
64+
65+
@Service
66+
@RequiredArgsConstructor
67+
public class RequestService implements IExecuteService {
68+
private final RequestProcessor processor;
69+
70+
@Override
71+
public void execute() {
72+
processor.process();
73+
}
74+
}
75+
76+
@Service
77+
public class InfoProcessor {
78+
public void execute() {
79+
}
80+
}
81+
82+
@Service
83+
public class RequestProcessor {
84+
public void execute() {
85+
}
86+
}
87+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Propose solution by looking on logs
2+
3+
## Task definition
4+
5+
```
6+
** Logs:
7+
8+
***************************
9+
APPLICATION FAILED TO START
10+
***************************
11+
12+
Description:
13+
14+
Parameter 0 of constructor in by.andd3dfx.templateapp.service.review.CommonService required a single bean, but 2 were found:
15+
- infoService: defined in file [C:\Work\Personal\spring-boot-3-template\target\classes\by\andd3dfx\templateapp\service\review\executors\InfoService.class]
16+
- requestService: defined in file [C:\Work\Personal\spring-boot-3-template\target\classes\by\andd3dfx\templateapp\service\review\executors\RequestService.class]
17+
```
18+
19+
## Solution
20+
21+
This may be due to missing parameter name information
22+
23+
Consider marking one of the beans as `@Primary`, updating the consumer to accept multiple beans, or using
24+
`@Qualifier` to identify the bean that should be consumed
25+
26+
```java
27+
28+
@Primary
29+
@Service
30+
@RequiredArgsConstructor
31+
public class InfoService implements IExecuteService {
32+
private final InfoProcessor processor;
33+
34+
@Override
35+
public void execute() {
36+
processor.process();
37+
}
38+
}
39+
```
40+
41+
or
42+
43+
```java
44+
45+
@Service
46+
public class CommonService<S extends IExecuteService> {
47+
private final S service;
48+
49+
@Autowired
50+
public CommonService(@Qualifier("infoService") S service) {
51+
this.service = service;
52+
}
53+
54+
void process() {
55+
service.execute();
56+
}
57+
}
58+
```
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
1+
```java
22
public class DirectoryFolder {
33
private Long id;
44
private String name;
55
private List<DirectoryFolder> subFolders;
66
}
7+
```

materials/code-review/code-review-3.txt renamed to interview-materials/code-review/code-review-3.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
1+
```java
22
// Сделать ревью кода сервиса DataService и метода создания/получения новой сущности Data.
33
// Метод создания может вызваться из разных потоков и должен быть безопасен для такого режима использования.
44
// AccessService и DataRepository безопасны для использования из разных потоков.
55
// Предложить как можно сделать лучше и починить проблемы, если они есть.
6-
@ReqArgsContructor
6+
7+
@ReqArgsConstructor
78
public class DataService {
89

910
private AccessService access; // final, change name to `accessService`
@@ -46,11 +47,14 @@ public class DataService {
4647
// @Repository to wrap exceptions
4748
public interface DataRepository { // extract to separate class
4849
void save(Data data);
50+
4951
Data get(String uid); // change name to findByUid
5052
}
5153

5254
public interface AccessService { // extract to separate class
5355
void checkRead();
56+
5457
void checkWrite();
5558
}
5659
}
60+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Preparation to interview
2+
3+
## Yandex
4+
5+
### Как проходит процесс найма в Яндекс (и советы, как повысить шансы на успех + много материалов для подготовки):
6+
7+
https://yandex.ru/jobs/pages/dev_interview
8+
9+
### Примеры задач, которые могут встретиться на интервью (6 задачек подходящие для Python, С++, С#, Java, JavaScript, Kotlin, Swift, Objective-C):
10+
11+
https://contest.yandex.ru/contest/8458/enter
12+
13+
### Пост на Хабре об алгоритмической секции с кодом:
14+
15+
https://m.habr.com/ru/company/yandex/blog/449890
16+
17+
### В этих видео мы разбираем решение алгоритмических задач:
18+
19+
- https://youtu.be/0yxjWwoZtLw
20+
- https://youtu.be/zU-LndSG5RE
21+
22+
### Как проходят архитектурные секции собеседования в Яндексе: практика дизайна распределённых систем:
23+
24+
https://habr.com/ru/company/yandex/blog/564132
25+
26+
### Числа, которые точно нужно знать:
27+
28+
https://github.com/donnemartin/system-design-primer/blob/master/README.md#appendix
29+
30+
### Практикум - подготовка к алгоритмической секции
31+
32+
https://practicum.yandex.ru/algorithms-interview
33+
34+
### FAQ с ответами на часто задаваемые вопросы:
35+
36+
https://yandex.ru/jobs/faq
37+
38+
### Код:
39+
40+
- https://leetcode.com/problemset/all
41+
- https://leetcode.com/problemset/algorithms
42+
- https://leetcode.com/problems/reverse-linked-list/solution
43+
- https://www.geeksforgeeks.org/reverse-a-linked-list
44+
- https://www.interviewbit.com/practice
45+
46+
### Материалы для подготовки:
47+
48+
- Примеры наших задач:
49+
- https://m.habrahabr.ru/company/yandex/blog/337690
50+
- https://m.habrahabr.ru/company/yandex/blog/340784
51+
52+
- Оценка сложности:
53+
- https://habr.com/ru/post/188010
54+
55+
- Подборка по алгоритмам:
56+
- https://github.com/tayllan/awesome-algorithms
57+
- https://m.habr.com/ru/company/yandex/blog/449890
58+
- https://habr.com/ru/post/78728
59+
60+
- Алгоритмы, которые чаще всего бывают в задачках:
61+
- сортировки (например, bubble sort или quicksort)
62+
- разворота одно/двусвязного списка
63+
- разворота строки
64+
- обхода дерева
65+
66+
## Not Yandex
67+
68+
First, it is highly recommended to start reading the following book (engineering sections):
69+
http://www.crackingthecodinginterview.com/contents.html
70+
71+
What to revise:
72+
• complexity of sorting algorithms
73+
• after solving every issue algorithm’s time complexity is usually discussed
74+
• DFS/BFS are frequently asked during coding interviews
75+
• solving some Dynamic programming problems would be useful because they are less intuitive than for example Greedy
76+
• Questions similar to climbing stairs: https://leetcode.com/problems/climbing-stairs/description
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
1+
# Tasks
2+
3+
## Pet Clinic REST API
14

2-
* Pet Clinic REST API
35
Design REST service related with Pet Clinic, where pets have name and age.
4-
Add operation with pets batch update (for example, add new field - owner)
6+
Add operation with pets batch update (for example, add new field - owner).
57

6-
GET /api/v1/clinic/{id}
7-
DELETE /api/v1/clinic/{id}
8-
POST /api/v1/clinic
9-
params: { name: ..., age : ... }
10-
PUT /api/v1/clinic/{id}
11-
params: { age: ... }
12-
PATCH /api/v1/clinic
13-
params: { ids: ..., owner: ... }
8+
- GET `/api/v1/clinic/{id}`
9+
- DELETE `/api/v1/clinic/{id}`
10+
- POST `/api/v1/clinic`
11+
params: { name: ..., age : ... }
12+
- PUT `/api/v1/clinic/{id}`
13+
params: { age: ... }
14+
- PATCH `/api/v1/clinic`
15+
params: { ids: ..., owner: ... }
1416

17+
## Sorting big strings task
1518

16-
* Sorting big strings task
1719
Propose algorithm for sorting a bunch of long strings situated on disk.
1820
We have restriction of RAM size: so only one string could be loaded into RAM simultaneously.
1921

22+
## Сортировки:
2023

21-
* Сортировки:
2224
- быстрая
2325
- со стеками
2426
- на месте
2527
- блочная
2628

27-
* Хеш-таблицы:
29+
## Хеш-таблицы:
30+
2831
- пробирование
2932
- линейное
3033
- квадратичное
@@ -33,19 +36,26 @@ We have restriction of RAM size: so only one string could be loaded into RAM sim
3336
- одинарное
3437
- двойное
3538

36-
* Сочетания, размещения, с повторениями/без
39+
## Сочетания, размещения
40+
41+
- с повторениями
42+
- без повторений
43+
44+
## Деревья:
3745

38-
* Деревья:
3946
- добавление вершин
4047
- поиск вершин
4148
- удаление вершин
4249
- префиксные деревья
4350

44-
* Search engine with suggestion ability
51+
## Search engine with suggestion ability
52+
4553
We have search engine, it provides web-interface with text field where a query could be typed.
46-
We want to add the next feature: when a user starts typing - he will get a suggestion with 10 most popular queries started from typed characters.
54+
We want to add the next feature: when a user starts typing - he will get a suggestion
55+
with 10 most popular queries started from typed characters.
4756
File with the most popular searches generated 1 time per day, it contains 1 mln lines, sorted by popularity.
4857
Propose the design of such system.
4958

50-
* Multithreading
59+
## Multithreading
60+
5161
Реализовать ReadWriteLock на базе обычного Lock

0 commit comments

Comments
 (0)