## Recent Interview Questions

More Questions »- 0of 0 votes
This question was asked in the chat, just adding here with the solution. I don't know for which company it is.

Replace wild cards with all possible combinations of zeros and ones using recursion.`Input String: 0?1? Output: 0010, 0011, 0110, 0111`

This is my solution using recursion:

`import java.util.*; public class ReplaceWildcardsRec { public static List<String> expandString(String s, int i) { List<String> l = new ArrayList<String>(); if(i>s.length()-1) { l.add(""); return l; } for(String expanded: expandString(s,i+1)) { if(s.charAt(i)=='?') { l.add('0'+expanded); l.add('1'+expanded); } else { l.add(s.charAt(i)+expanded); } } return l; } public static void main(String[] args) { List<String> l = new ArrayList<String>(); String s = "1111?"; l = expandString(s,0); System.out.println(l); } }`

- 0of 0 votes
Sort two sorted Linked Lists.

Write your own implementation of structs / classes you might need to use.

Try to come up with the best time and space complexity.

I ran out of time after merging the two lists in O(n) time and O(1) space, but I am guessing he wanted to expand the solution to implement a merge sort algorithm for an unsorted Linked List.

- 0of 0 votes
write boundary test cases for whether a linked list is circular linked list or not?

- 0of 0 votes
Write a java program logic to find whether list is circular

linked list or not?

- 0of 0 votes
Write a function that takes the following inputs and gives the following outputs.

Input: A list of points in 2-dimensional space, and an integer k

Output: The k input points closest to (5, 5), using Euclidean distance

Example:

Input: {(-2, -4), (0, 0), (10, 15), (5, 6), (7, 8), (-10, -30)}, k = 2

Output: {(5, 6), (7, 8)}