Testdome Java Questions And Answers -
The Task: Given a social network structure ( Member class with a list of friends ), find all friends of a specific degree (e.g., degree 2 are "friends of friends"). The Challenge: Dealing with a complex graph data structure and avoiding infinite loops.
Implementing or manipulating linked lists, binary search trees, and stacks. testdome java questions and answers
public class Merger public static int[] mergeSorted(int[] a, int[] b) int[] result = new int[a.length + b.length]; int i = 0, j = 0, k = 0; while (i < a.length && j < b.length) result[k++] = (a[i] <= b[j]) ? a[i++] : b[j++]; The Task: Given a social network structure (
currentDegree++; int levelSize = queue.size(); for (int i = 0; i < levelSize; i++) Member current = queue.poll(); for (Member friend : current.getFriends()) if (!visited.contains(friend)) queue.add(friend); visited.add(friend); public class Merger public static int[] mergeSorted(int[] a,
Landing a software engineering role often requires passing an automated technical screening. Among the most popular platforms used by employers today is TestDome. Known for its rigorous, time-crucial coding challenges, TestDome evaluates your practical programming skills rather than just rote memorization.
. The function should return a Tuple containing both roots. You can assume the equation always has two real roots.