Are you currently working or not, and in what format — office, hybrid, remote?
Golang
What programming languages do you use besides Go?
/* We need to transfer data from a certain source to a certain consumer. The source delivers data in small batches (~ten records), while the consumer works more efficiently with larger batches. A real-world example is supplying data from Kafka queues to a Clickhouse database. Source: - Conditionally infinite. - The source never returns more than MaxItems records per Next call. - Within a single "session" (one call to the Pipe function), the source returns new data on each Next call. - However, after a restart, the source resumes from the last "confirmed" position, indicated by a cookie. Therefore, *each* cookie value returned by Next, after data is saved in the receiver, must be fixed with a Commit call, strictly in the same order they were returned by Next. Receiver: - Cannot process more than MaxItems at once. Basic level: Implement a function func Pipe(p Producer, c Consumer) error that reads data from the source, groups it into a buffer of size not exceeding MaxItems, and saves it to the receiver, then commits the progress in the source. */ const MaxItems = 9999 type Producer interface { // Next returns: // - batch of items to be processed // - cookie to be committed when processing is done // - error Next() (items []any, cookie int, err error) // Commit is used to mark data batch as processed Commit(cookie int) error } type Consumer interface { Process(items []any) error } func Pipe(p Producer, c Consumer) error { var buf []any var cookies []int for { items, cookie, err := p.Next() if err != nil { return err } buf = append(buf, items...) cookies = append(cookies, cookie) if len(buf) >= MaxItems { if err := c.Process(buf); err != nil { return err } for _, c := range cookies { if err := p.Commit(c); err != nil { return err } } buf = buf[:0] cookies = nil } } if len(buf) > 0 { if err := c.Process(buf); err != nil { return err } for _, c := range cookies { if err := p.Commit(c); err != nil { return err } } } return nil }
What performance metrics did you use to evaluate your last project?
What is your experience in implementing and configuring authentication and authorization systems?
func countSubs(s string) int { result := 0 left := 0 hm := make(map[rune]int) n := len(s) for right := 0; right < n; right++ { hm[s[right]]++ for hm[s[right]] > 1 { hm[s[left]]-- if hm[s[left]] == 0 { delete(hm, s[left]) } left++ } result += (right - left + 1) } return result }
How does a L4 load balancer differ from an L7 load balancer?
""" Seats in the cinema are arranged in a single row. A newly arrived viewer chooses a seat to sit as far away as possible from other viewers in the row. That is, the distance from the seat where the viewer sits to the nearest viewer should be maximized. It is guaranteed that there are always free seats in the row and at least one viewer is already seated. Write a function that, given a row of seats (an array of zeros and ones), returns the distance (number of gaps between seats) from the chosen seat to the nearest viewer. [1, 0, 0, 0, 1] -> 2 [1, 0, 1, 0, 0, 1, 0, 0, 1] -> 2 [1, 0, 1, 0] -> 1 [0, 0, 0, 1] [1, 0, 0, 0] place = ((right - left) / 2) """ func maxPlaces(arr []int) int { }
""" Seats in a cinema are arranged in a row. A newly arrived viewer chooses a seat to sit as far as possible from other viewers. That is, the distance from the seat they choose to the nearest viewer should be maximized. It is guaranteed that there are always free seats and at least one viewer is already seated. Write a function that, given the row of seats (an array of zeros and ones), returns the distance (number of gaps between chairs) from the chosen seat to the nearest viewer. [1, 0, 0, 0, 1] -> 2 [1, 0, 1, 0, 0, 1, 0, 0, 1] -> 2 [1, 0, 1, 0] -> 1 """
/* * Given an array of integers and a number X, * find the longest non-empty subarray with a minimum equal to X. * Return the length of such a subarray or -1 if none exists. */
Which project should you choose for a technical interview and how to describe it?
How is the execution time of adding an element by key in a data structure Map determined?
How to visually or algorithmically determine that an element is unique in a Map data structure?
Why are there two checks if (on line 79 and on the line with len(buf)==MaxItems), and not just one?
What request rate per second was achieved during data recording?
// For two arrays of integers of length N, // for all K from 1 to N, count the number of common numbers in prefixes of length K. // The numbers within the arrays may repeat, and the intersection is counted without considering multiplicity. // A prefix of length K of array A is the first K elements of array A // A [1, 1] => [1], [1, 1] // B [1, 1] => [1], [1, 1] // R [1, 1] // [1, 2, 5] => [1], [1, 2], [1, 2, 5] // [1, 5, 4] => [1], [1, 5], [1, 5, 4] // [1, 1, 2]
[name] indicated: on line 20, uniq does not contain the number of unique characters, but something else. What exactly?
// Given two sorted sequences of integers in non-decreasing order. // Return all elements from the first sequence that are not in the second. // 0 <= N <= 10^6 // -10^9 <= a[i] <= 10^9 // [1] // [2, 3, 4, 5, 6] // [1] // [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ...] // [1] // [2, 3, 4, 5, 6, 7, 8] func filter(first []int, second []int) []int { res := make([]int, 0, len(first)) i, j := 0, 0 for i < len(first) && j < len(second) { if first[i] < second[j] { result = append(result, first[i]) i++ } else if first[i] > second[j] { j++ } else { i++ j++ } } for i < len(first) { result = append(result, first[i]) i++ } return result }
Tell about the most complex and interesting problem you have solved, especially about architectural experience.
How to move the window in the sliding window algorithm?