void singleChar() { assertEquals("a", }
Java
For example, creating an order. There is a request to the service and a response, with inter-service and external goods described (for example, for calculating the popularity of goods). The service repeatedly performs slowly or times out, and we fail to respond, losing the order. What to do to stop losing orders and, accordingly, money?
Write an SQL query to select the names of the three most read authors currently (those with the most books on hand).
Evaluate the algorithmic complexity of the palindrome problem solution in terms of time and memory. If the alphabet is fixed (English letters, 26 characters), what is the memory complexity?
For an array of numbers arr and a number k, return a new array whose number of repeated elements does not exceed k. Example: Input: arr=[1,1,1,2,3,3,3,4,4], k=3 Output: res=[1,3,4]
Describe the library model. There are 3 entities: "Author", "Book", "Reader". Physically, there is only one book and it can only be with one reader. Create tables for the library considering this.
/** * Implement transferring funds between two accounts. Note that this is a production solution * Input parameters: * @param fromAccountId the unique identifier of the user transferring funds * @param toAccountId the unique identifier of the user receiving funds * @param amount the transfer amount. A positive number */ public void transferMoney(Long fromAccountId, Long toAccountId, BigDecimal amount) { }
What is VACUUM in PostgreSQL and why is it needed?
Write an SQL query: select the titles of all books with more than three authors.
/** * chars = ['a', 'a', 'a', 'b', 'b', 'c', 'a'] * return: a3b2ca2 */ class JavaTask3Solution { public String compress(char[] chars) { } }
How to scale a service with linear load growth? What to do when horizontal scaling hits database limits?
Outbox pattern: how to ensure atomicity of database write and event sending to the queue?
How to implement rate limiting for an external API with RPS restrictions? How do virtual threads/coroutines differ from system threads?
Write an SQL query: select the titles of all books currently checked out by readers.
Scenario: There are 3 entities - user, chat, message - User has a name and registration date - Chat has a name and creation date - Message has text, author, and creation date - A user can be part of multiple chats simultaneously - A message must belong to a chat, and cannot belong to more than one chat at the same time - Describe the domain model in the form of tables
What types of sharding exist? Describe the main approaches.
What is the difference between Cassandra and PostgreSQL? Please describe the main differences.
For a given string, it is necessary to determine the length of the largest palindrome that can be formed from its characters. A palindrome is a word that reads the same from the beginning and the end, for example "level" or "deified". Example: Input: aaabbbcccddd Output: 11 (palindrome dccbbaaabbccd)
There are 3 entities - user, chat, message - User has a name and registration date - Chat has a name and creation date - Message has text, author, and creation date - User can be in multiple chats simultaneously - Message must belong to a chat, and cannot belong to more than one chat at the same time - Describe the domain in the form of tables.
Is it necessary to wrap the transferMoney method in @Transactional and why?