Open gewhiz opened 9 years ago
How would you design a URL shortener? =============================
A greedy interval scheduling problem
find a list of unique IP address from a text file? ========================= http://stackoverflow.com/questions/14866578/get-all-ip-addresses-from-a-file-using-regex-java
all the combination of factors of one number http://stackoverflow.com/questions/15122437/print-all-unique-combination-of-factors-of-a-given-number
code a text justification routine (Given a line length insert white space so text is uniformly displayed within the given length). leetcode
Given a single-line text string and a maximum width value, write the function 'string justify(string text, int maxWidth)' that formats the input text using full-justification, i.e., extra spaces on each line are equally distributed between the words; the first word on each line is flushed left and the last word on each line is flushed right.
a deep iterator
Program an iterator for a Linked List which may include nodes which are nested within other nodes. i.e. (1)->(2)->(3(4))->((5)(6). Iterator returns 1->2->3->4->5->6
http://blog.baozitraining.org/2014/08/linkedin-twitter-and-hulu-onsite-how-to.html
public class BipartiteGraphs { public static void main(String[] args) { boolean[][] adj = new boolean[4][4]; adj[0][1] = true; adj[1][0] = true; adj[1][2] = true; adj[2][1] = true; adj[0][3] = true; adj[3][0] = true; adj[1][3]=true; adj[3][1]=true;
System.out.println(check(adj));
}
public static boolean check(boolean[][] adj) {
int[] colors = new int[adj.length];
Queue<Integer> q = new LinkedList<Integer>();
colors[0] = 1;
q.add(0);
while (!q.isEmpty()) {
int t = q.poll();
int expected;
if (colors[t] == 1)
expected = 2;
else
expected = 1;
for (int i = 0; i < adj[t].length; i++) {
if (adj[t][i]) {
if (colors[i] != 0) {
if (colors[i] != expected)
return false;
} else {
colors[i] = expected;
q.add(i);
}
}
}
}
return true;
}
}
Design data structure to implement T9 dictionary
Design an Hangman. { They expect MVC architecture. } Design a scalable server for the hangman game battleship game ***
LRU cache
HashMap implementation Multi-thread
co-linear points in a plane
given like +77288.100, a772sb, 2000.00.11. return if it's a number. you could either write a regular expression or simply go through the string.
implement a concurrent read-write buffer
load-balanced message queues, distributed hashmaps of sorted structs containing 5 URLs and their timestamps,
public interface Intervals { /**
}
Read in depth about the technologies that you have used so far, even though you haven't used it recently.
design a web calendar
ATOI conversion .
Write a function to determine if a string is an integer.
lowest common ancestor given two nodes
find the median of two sorted int arrays
replace all subarrays in an original array which match a given array, replace using another array. For example, we have: original array: "aaabbc" findarray: "bb" replaceArray: "ee" After running your function, it should be "aaaeec";
You need to distribute a terabyte of data from a single server to 10,000 nodes, and then keep that data up to date. It takes several hours to copy the data just to one server. How would you do this so that it didn't take 20,000 hours to update all the servers? Also, how would you make sure that the file wasn't corrupted during the copy?
Consider an X x Y array of 1's and 0s. The X axis represents "influences" meaning that X influences Y. So, for example, if $array[3,7] is 1 that means that 3 influences 7. An "influencer" is someone who influences every other person, but is not influenced by any other member. Given such an array, write a function to determine whether or not an "influencer" exists in the array.
design web crawler system
like load-balanced message queues, distributed hashmaps of sorted structs containing 5 URLs and their timestamps, and using LRU methods to GC the old data.
How would you design an enhancement to the LinkedIn homepage that displays 24-hour trailing lists (5-minute, 1-hour, 1-day) of the top 5 URLs that users post onto the site?
////Need to describe how to handle possible high volume concurrent submissions, how to store URLs, how to compute the trailing lists, and how to clean up stale data, all in the context of a load-balanced scalable architecture. //////////////// Given an interface called IntStream with methods 'bool hasNext()' and 'int next()', implement the function 'IntStream merge(IntStream[] streams)' where each input IntStream produces strictly increasing, possibly infinite number of, integers, and the resultant IntStream also produces strictly increasing integers by merging the input streams. The interviewer also provides a simple test harness that prints the first 5000 integers from that function.
Message queues
consider a B2C website like Amazon, which will receive thousands requests from buyer per minutes. How will you design the "shop cart " component for it? where should the customs' shop cart data stored==============================
In a given list of words, find matching words in the list that can be generated from the patterns of a given word.
How many instances of singleton can be in JVM?
co-linear points in a plane
implement a concurrent read-write buffer.
Implement Java Iterator interface in a question that requires a tree traversal-like algorithm. (get next!!!)
describe a machine learning method, how to deal with sparse data!!!!
What is List Comprehension? What's the difference between a list and a tuple.
Given a paragraph and line length, write a routine to justify words in the paragraph. Write a routine to find all collinear points in a plane. Constraint: The time complexity cannot be greater than O(n^2)