Is a binary tree a balanced structural state?
Golang
Can you explain what the term 'Consumer group' means in Kafka system?
How to kill a process in Linux? With which commands?
What tools were used for application performance analysis?
We have a database of user passwords, passwords are hashed (using hashPassword function), and we also know the set of characters that can be used in passwords (variable alphabet). Our task is to implement the RecoverPassword function so that it recovers the password from the known hash and TestRecoverPassword completes successfully. Basic requirements: Solve as you wish package main import ( "crypto/md5" "fmt" ) var alphabet = []rune{'a', 'b', 'c', 'd', '1', '2', '3'} func RecoverPassword(h []byte) string { return "" } func hashPassword(in string) []byte { h := md5.Sum([]byte(in)) return h[:] } func main() { tests := []string{"a", "12", "abc333d"} ok := true for _, exp := range tests { h := hashPassword(exp) act := RecoverPassword(h) if act != exp { fmt.Printf("Error: expected %q, got %q\n", exp, act) ok = false } } if ok { fmt.Println("Tests passed successfully") } }
What does the top team do under the hood (from the interviewer's question)?
Write a function Exclude that returns elements from slice a that are not in slice b.
Write a query that corrects data: replace parent_id with NULL only for categories that refer to themselves. The expected state of the table after update is shown.
What criteria will you use to choose an employer if you have multiple offers?
Tell about your experience with programming languages other than Go, and how do you like Go itself?
How did you solve the data desynchronization problem during migration between storages?
Who makes the decision to rollback?
What metrics do you track to assess the state and performance of services?
On line 15, the map declaration should be with square brackets, not curly braces. Why?
How does top calculate CPU%? What algorithm does it use?
How much code do you usually write in Go per project or period?
In a query, WHERE is used, but there is also the HAVING operator — what is the difference between them?
Apart from Go, what other message brokers, databases, have you worked with?
1. Display unique combinations of user and product id for all purchases made by users before they were banned. Sort first by username, then by SKU. 2. Find users who made purchases totaling more than 5000 rubles. Display their id, first name, last name, and total purchase amount in the format: user id | first name | last name | total amount.
There is the following database schema -- Customers table CREATE TABLE customers ( id BIGSERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL ); -- Products table CREATE TABLE products ( id BIGSERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, category VARCHAR(100) ); -- Order items table CREATE TABLE order_items ( order_id BIGINT NOT NULL, product_id BIGINT NOT NULL, qty DECIMAL(10, 3) NOT NULL CHECK (qty > 0), -- 10 digits, 3 decimal places price NUMERIC(10, 2) NOT NULL CHECK (price >= 0), PRIMARY KEY (order_id, product_id) ); -- Orders table CREATE TABLE orders ( id BIGSERIAL PRIMARY KEY, customer_id BIGINT, order_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, status VARCHAR(50) NOT NULL CHECK (status IN ('pending', 'paid', 'shipped', 'delivered', 'cancelled')) ); 1. Show the TOP 10 users by total order amount who have made more than 2 orders in the last 30 days. 2. Show the TOP 3 categories by revenue over the last 6 months.