# Aayush Lal Roy | 2+ yrs exp - Good with coding question. DS/algo. - DB design is aldo good. - Can proceed with next round - Php, java, Ruby on rails, nodejs - MySQL - Messaging Queue - SQS - AWS - SNS, EC2, S3 # Question 1: array - ['a', 'b', 'c'] abc acb bac bca cab cba ```java! // logic public class Scramble { public static void main(String args[]) { String arr[] = new String[]; //original array String arr1[] = new String[fact(arr.length)]; scramble(arr, arr1, 0); for (String s : arr1) { System.out.println(s); } } public static void scramble(String arr[], String arr1[], int element) { if (arr.length() == 1) { return arr[0]; } for (int i = 0; i < arr.length; i++) { int newArr[] = new int[arr.length - 1]; count = 0; for (int j = 0; j <= arr.length; j++) { if (j == i) { continue; } else { newArr[count++] = arr[j]; } } String s1 = scramble(newArr, arr1, i); arr1[i] = s1 + arr[i]; } } public static int fact(int len) { int factorial = 1; for (int i = 1; i <= len; i++) { factorial *= i; } return factorial; } } ``` # Question 2: DB User service Chat service - 1<>1 chat - text chat - list of conversations, sorted - list of messages. sorted, - id - created_at - modified_at - created_by_user_id - modified_by_user_id - soft_deleted #Tables: - coversations - name - profile_photo_link - metadata - is_group - user_conversation_mapping: - group_id - user_id - messages: - text - conversation_id: Select * from conversations where user_id_1 = 123 OR user_id_2 = 123 order by modified_at desc limit 50 offset 0;