Sobes.tech

/** * Find the person with the minimum age in a room with the maximum number of people * At the end of the solution method, call writeSolution(user, room) */

Senior
192

How to solve the problem with NFT 50ms at current RT 150ms + 350ms? Suggest an architectural solution.

Middle
192

Have you worked with locks in databases? How did you acquire locks?

Senior
192

What are functional interfaces? Which ones do you know? What do they accept and what do they return?

Middle
192

What does the reduce method do?

Senior
192

[name] asked: what databases have you worked with? Postgres, Redis — that's clear, but what about non-relational ones like MongoDB or others?

Middle+
192

Why did you use Spring Web for API Gateway instead of ready-made proxy solutions like Nginx, Envoy?

192

The database is large, indexes are built, the plan has been reviewed — what else can be done for optimization?

Senior
192

How do LinkedList and HashMap differ? How does LinkedHashMap differ from HashMap?

Senior
192

Have you ever explained to a client or analyst why a task takes 2 days instead of 10?

192

What approaches do you use for versioning REST API to ensure compatibility between different clients, and what difficulties have you faced?

192

```java import java.util.*; import java.lang.*; import java.io.*; class Codechef { public static void main (String[] args) throws java.lang.Exception { var autoNumbers = List.of(List.of("A123BC", "B421FT"), List.of("O543EC","B421FT", "I222OA")); autoNumbers.stream().flatMap(Collection::stream).flatEach(System.out/System.out.println()); Map<String, String> numberMap = autoNumbers.stream().flatMap(Collection::stream).collect(Collectors.toMap( n -> n, n -> n.replaceAll("[^0-9]", ""))); System.out.println(numberMap); } } ```

192

Tell about what you have translated from synchronous to asynchronous mode and why it was done.

192

@Data @Entity @Table(name = "_store") public static class Book { @Id private String id; private String title; private String author; private int price; @Transient private String tmp; @Enumerated(EnumType.STRING) private BookType type; } public enum BookType { COMMON, PREMIUM; }

192

```java // 2 public class Interfaces { public static void main(String[] args) { A a = new A() {}; B b = new B() {}; AB ab = new AB(); a.print(); b.print(); ab.print(); } public interface A { default void print() { System.out.println("interface A"); } } public interface B extends A { default void print() { System.out.println("interface B"); } } public static class AB implements A, B { } } ```

Senior
192

How do you feel about AI potentially replacing developers? How do you see development in 2-3 years?

192

import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class badCounter { public static Map<String, Integer> mapOfBadNames = new HashMap<>(); protected void doProcessing(String filePath) throws IOException { try { FileInputStream fis = new FileInputStream(filePath); BufferedReader br = new BufferedReader(new InputStreamReader(fis)); while((br.readLine())!=null){ processWords(br.readLine()); } br.close(); fis.close(); } catch (IOException | NullPointerException ex) { System.out.println(ex.getMessage()); } } private void processWords(String line) { Arrays.stream(line.split(" ")) .map(String::trim) .forEach(word -> { if(mapOfBadNames.containsKey(word)){ mapOfBadNames.put(word, mapOfBadNames.get(word)+1); } else{ mapOfBadNames.put(word, 1); } }); } public void writeResultToFile(String path) throws IOException { try { PrintWriter out = new PrintWriter(path); out.println("word,frequency"); for(Map.Entry<String, Integer> entry : mapOfBadNames.entrySet()){ out.println(entry.getKey() + "," + entry.getValue()); } out.close(); } catch (NullPointerException | IOException ex) { throw new RuntimeException("Error writing to file", ex); } } public boolean isEverythingFine() { return true; } public static void main(String[] args) { badCounter bcn = new badCounter(); try { bcn.doProcessing("bad_input.txt"); bcn.writeResultToFile("result.csv"); bcn.doProcessing("bad_input1.txt"); bcn.writeResultToFile("result1.csv"); } catch (IOException ex) { System.out.println("Something went wrong"); } } }

Senior
191
/740