Техническое интервью: walk me through, trade-off, edge case

Тема дорожной карты · Английский для IT

🔊 Словарь терминов с произношением →

Техническое интервью — разбор кода или задачи вслух, и его английский состоит из двух слоёв: фраз интервьюера, которые нужно понимать мгновенно, и фраз кандидата, которые нужно произносить не задумываясь. Интервьюер: Walk me through your solution — объясните решение шаг за шагом; Talk me through your thinking — рассуждайте вслух; What's the time complexity? — временная сложность (O of n, O of n log n, O of one, constant, linear, quadratic, logarithmic); What's the space complexity?; Can you do better? — можно ли лучше (намёк, что решение неоптимально); What are the edge cases? — граничные случаи (пустой ввод, один элемент, дубликаты, отрицательные числа, переполнение, Unicode, null); How would you test this?; What happens if…? — что если; What are the trade-offs? — компромиссы; Why did you choose X over Y?; How would this scale?; What would you do differently in production?; Let's say the input is… — допустим, ввод такой; Assume that… — предположим; Feel free to use any language — любой язык; Don't worry about syntax — не беспокойтесь о синтаксисе; You're on the right track — верным путём; That's a reasonable approach — разумный подход; Let's move on — идём дальше (часто значит «достаточно» или «время»); We have five minutes left. Кандидат: уточнение — Just to make sure I understand: …, Can I assume the input fits in memory?, Are duplicates possible?, Should I handle invalid input?, What should happen when the list is empty?; план — My first thought is…, A brute-force approach would be…, I'd start with a naive solution and then optimize, The key insight is…, One way to do this is…, Alternatively…; рассуждение вслух — I'm thinking about…, Let me consider…, Bear with me for a second, I'm going to sketch this out, Let me trace through an example; компромиссы — The trade-off here is memory for speed, This is O(n) time but O(n) space, We could cache this at the cost of staleness, It depends on whether reads or writes dominate; исправление — Actually, wait, there's a bug here, Let me fix that, Good catch, I missed the empty case; завершение — To summarize…, This handles all the cases we discussed, In production I'd also add…, Is there anything you'd like me to expand on?. Термины: brute force, naive, optimal, greedy, dynamic programming, two pointers, sliding window, hash map, heap / priority queue, BFS / DFS, recursion, memoization, bottleneck, off-by-one error, boundary condition, corner case, happy path, invariant, precondition, under the hood — «под капотом», gotcha — подвох.

Как произносится

Walk me through /ˌwɔːk miː ˈθruː/ (l в walk немая, с «θ»), trade-off /ˈtreɪd ɒf/, edge case /ˈɛdʒ keɪs/, corner case /ˈkɔːrnər keɪs/, complexity /kəmˈplɛksəti/, O of n /ˌoʊ əv ˈɛn/ («оу ов эн»), n log n /ˌɛn ˈlɒɡ ˈɛn/, logarithmic /ˌlɒɡəˈrɪðmɪk/, quadratic /kwɒˈdrætɪk/, linear /ˈlɪniər/, constant /ˈkɒnstənt/, naive /naɪˈiːv/ («найИв», два слога, ударение на второй), brute force /bruːt fɔːrs/, greedy /ˈɡriːdi/, recursion /rɪˈkɜːrʒən/, memoization /ˌmɛmoʊaɪˈzeɪʃən/ (без r, не memorization), heap /hiːp/, hash /hæʃ/, invariant /ɪnˈvɛəriənt/, iterate /ˈɪtəreɪt/, traverse /trəˈvɜːrs/, optimize /ˈɒptɪmaɪz/, optimal /ˈɒptɪməl/, assume /əˈsjuːm/, insight /ˈɪnsaɪt/, sketch /skɛtʃ/, trace /treɪs/, gotcha /ˈɡɒtʃə/, under the hood /ˌʌndər ðə ˈhʊd/.

Как употребляется

Фрагмент интервью:

Interviewer: Given a list of transactions, find the first duplicate transaction id. Walk me through your thinking. Candidate: Sure. Just to make sure I understand: duplicates are exact id matches, and I return the first id that appears twice, in order of appearance? Can I assume the list fits in memory? Interviewer: Yes on both. Candidate: A brute-force approach would be a nested loop, which is O(n squared). The key insight is that I only need to know whether I've seen an id before, so a hash set gives me O(n) time and O(n) space. Let me sketch it… I iterate once, and for each id, if it's in the set I return it, otherwise I add it. Edge cases: an empty list returns null, a single element returns null, and if ids can be null I'd want to clarify how to treat those. Interviewer: Can you do better on space? Candidate: If the list is sorted or I'm allowed to sort it, I could do it in place in O(n log n) time and O(1) extra space, but that changes the order and the trade-off is time for memory. It depends on the constraints. Interviewer: Good. Let's move on.

Ловушки

Первая ловушка — молчаливое кодирование: в англоязычном интервью ожидают thinking aloud, и тишина читается как ступор. Вторая — начинать писать код до уточняющих вопросов: just to make sure I understand обязателен. Третья — naive с одним слогом «найв»: два слога. Четвёртая — memorization вместо memoization: разные слова. Пятая — Can you do better? воспринимать как «всё плохо»: это стандартный намёк на оптимизацию, ответ let me think about the bottleneck. Шестая — Let's move on принимать за похвалу: часто это «время вышло» или «достаточно», продолжать не нужно. Седьмая — O(n) читать как «о-эн» по-русски: O of n. Восьмая — путать edge case и corner case: edge — одна граница (пустой ввод), corner — несколько одновременно. Девятая — признание бага без исправления: there's a bug here должно продолжаться let me fix that, и это плюс, не минус.

Связанные понятия

Полезные ресурсы