Question library
Questions from real interviews. Drill any of them by voice in a couple of minutes, with an interviewer, a score and feedback.
Write a function top_words that takes a string of text and a number n, and returns the n most frequent words as a list of pairs: the word and how many times it occurred. Case doesn't matter, punctuation is discarded, and words with equal frequency are ordered alphabetically.JuniorДан неотсортированный массив различных целых чисел. Сверните его в строку диапазонов через запятую. Например, для массива [1, 4, 5, 2, 3, 9, 8, 11, 0] ответ — строка «0-5,8-9,11».Mid-levelДан список отрезков, каждый задан началом и концом. Нужно объединить все пересекающиеся отрезки. Например, из [1, 3], [2, 6], [8, 10], [15, 18] получается [1, 6], [8, 10], [15, 18].Mid-level